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

Is file a keyword in c?

890


What is realloc in c?

1030


How to declare a variable?

966


Do you know pointer in c?

1000


Describe explain how arrays can be passed to a user defined function

1052


How will you declare an array of three function pointers where each function receives two ints and returns a float?

1306


int i=3; this declaration tells the C compiler to a) reserve space in memory to hold the integer value b) associate the name i with this memory location c) store the value 3 at this location d) all the above

1229


How can I write functions that take a variable number of arguments?

1087


List the difference between a 'copy constructor' and a 'assignment operator' in C?

1045


What do you mean by a sequential access file?

1048


Should I learn c before c++?

1184


In c programming typeing to occupy the variables in memory space. if not useing the variable the memory space is wasted.ok, how to avoid the situation..? (the variable is used & notused)

2070


Write a program to input the price of 1 burger and the number of burgers eaten by a group of friends .print the total amount to be paid by the group?

995


Explain what will the preprocessor do for a program?

1011


What is the use of static variable in c?

1052