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

What is the value of c?

1061


Are negative numbers true in c?

1054


What is the method to save data in stack data structure type?

1079


I was asked to write a program in c which when executed displays how many no.of clients are connected to the server.

2363


What is a spanning Tree?

1575


What is volatile variable in c?

1087


In C language, the variables NAME, name, and Name are all the same. TRUE or FALSE?

1222


can any one tel me wt is the question pattern for NIC exam

1965


Explain heap and queue.

1073


What does static variable mean in c?

1095


If a five digit number is input through the keyboard, write a program to print a new number by adding one to each of its digits.For example if the number that is input is 12391 then the output should be displayed as 23402

3907


What is difference between union and structure in c?

1152


What are data structures in c and how to use them?

1162


Explain what are bus errors, memory faults, and core dumps?

1268


Why do we use stdio h and conio h?

1078