Program to write some contents into a file using file
operations with proper error messages.
Answers were Sorted based on User's Feedback
Answer / manvitha
//writing into a file
main()
{
char c;
FILE *fp;
fp=fopen("infor.dat",'w');
printf("enter data \n enter tab & enter a stop\n");
do
{
c=getchar();
put c(c,fp);
}while(c!='\t');
fclose(fp);
getch();
}
Is This Answer Correct ? | 6 Yes | 2 No |
Answer / vignesh1988i
#include<stdio.h>
#include<conio.h>
void main()
{
FILE *pointer;
char character;
pointer=fopen("hello.c","w"); /*there must be a file in your
path*/
if(pointer==NULL)
printf("CANT OPEN THE FILE ,ITS NOT PRESENT IN THE DIRECTORY");
else
{
fflush(stdin); /*a fun() used to clear the buffer memory*/
while(1)
{
scanf("%c",&ch);
fprintf(pointer,"%c",ch);
if(ch=='$')
break;
}
}
fclose(pointer);
getch();
}
Is This Answer Correct ? | 4 Yes | 4 No |
Write a program in "C" to calculate the root of a quadratic equation ax^2+bx+c=0, where the value of a,b & c are known.
hi, which software companys will take,if d candidate's % is jst 55%?
Write a program which take a integer from user and tell whether the given variable is squar of some number or not. eg: is this number is 1,4,9,16... or not
what is diognisis?
Describe the steps to insert data into a singly linked list.
exit () is used to a) exit () terminates the execution of the program itself b) exit () terminates the execution of the loop c) exit () terminates the execution of the block d) none of the above
What is use of integral promotions in c?
what is the difference between global variable & static variable declared out side all the function in the file.
What is indirection in c?
what is the different bitween abap and abap-hr?
Is main is a keyword in c?
what is pointer ?
10 Answers Kernex Micro Systems,