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 |
Can you please compare array with pointer?
When I tried to go into a security sites I am denied access and a message appeared saying 'applet not initialize'. How can I rectify this problem.
If errno contains a nonzero number, is there an error?
main() { int a = 65; printf(“%d %o %x”,a,a,a); } Output 65 101 41 Please explain me.How it is coming like that?
What does typedef struct mean?
praagnovation
If one class contains another class as a member, in what order are the two class constructors called a) Constructor for the member class is called first b) Constructor for the member class is called second c) Only one of the constructors is called d) all of the above
What is double pointer in c?
4) Write a program that takes a 5 digit number and calculates 2 power that number and prints it. i have done maximum par but i m findind problem in the commented area. please help...
What is meant by errors and debugging?
What is the use of the restrict keyword?
why arguments can generally be passed to functions a) sending the values of the arguments b) sending the addresses of the arguments c) a & b d) none of the above