Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Program to write some contents into a file using file
operations with proper error messages.

Answer Posted / 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



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

a value that does not change during program execution a) variabe b) argument c) parameter d) none

1238


What is volatile variable in c with example?

1045


write a program to display all prime numbers

1972


Do pointers need to be initialized?

1084


What are the primitive data types in c?

1079


What is a program flowchart?

1204


Differentiate between static and dynamic modeling.

1129


What is dynamic variable in c?

1033


Which is more efficient, a switch statement or an if else chain?

1027


which of the following is allowed in a "C" arithematic instruction a) [] b) {} c) () d) none of the above

1725


How to Throw some light on the splay trees?

1066


What's the total generic pointer type?

1055


Write a function which takes as parameters one regular expression(only ? and * are the special characters) and a string and returns whether the string matched the regular expression.

1098


Is python a c language?

1012


What are dangling pointers in c?

1234