ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   SiteMap shows list of All Categories in this site.
Google
 
Categories  >>  Software  >>  Programming Languages  >>  C
 
 


 

 
 C interview questions  C Interview Questions
 C++ interview questions  C++ Interview Questions
 VC++ interview questions  VC++ Interview Questions
 Delphi interview questions  Delphi Interview Questions
 Programming Languages AllOther interview questions  Programming Languages AllOther Interview Questions
Question
Program to write some contents into a file using file 
operations with proper error messages.
 Question Submitted By :: Kantharaju
I also faced this Question!!     Rank Answer Posted By  
 
  Re: Program to write some contents into a file using file operations with proper error messages.
Answer
# 1
#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 ?    1 Yes 1 No
Vignesh1988i
 

 
 
 
Other C Interview Questions
 
  Question Asked @ Answers
 
Write a program to print this triangle: * ** * **** * ****** * ******** * ********** Don't use printf statements;use two nested loops instead. you will have to use braces around the body of the outer loop if it contains multiple statements.  2
How can I find out how much memory is available? Persistent1
Reverse the part of the number which is present from position i to j. Print the new number. eg: num=789876 i=2 j=5 778986  1
what is the function of .h in #include<stdio.h> in c ? IBM9
if ENTERED FIVE DIGITS DESIGN A PROGRAM THAT WILL FIND CORRESPONDING VALUE FROM ASCII TABLE  1
find a number whether it is even or odd without using any control structures and relational operators? Microsoft14
a 'c' program to tell that the set of three coordinates lie on a same line Persistent1
Print all numbers which has a certain digit in a certain position eg: number=45687 1 number=4 2 number=5 etc  2
Concat two string with most overlapped substring has to remove  "abcd"+ "cdef" = "abcdef  5
related to rdbms query .  1
write a own function for strstr LG-Soft1
Why doesn't the code "a[i] = i++;" work?  4
wt is d full form of c Wipro1
what is the use of getch() function in C program.. difference b/w getch() and getche()?? Wipro12
What are the different pointer models in c?  3
What is the diffrent between while and do while statement ?  5
enum colors {BLACK,BLUE,GREEN} main() { printf("%d..%d..%d",BLACK,BLUE,GREEN); return(1); } ME3
#define d 10+10 main() { printf("%d",d*d); }  3
What do you mean by team??  2
Write a program or provide a pseudo code to flip the 2nd bit of the 32 bit number ! (Phone Screen) NetApp1
 
For more C Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com