#include <stdio.h>
|
|
int
fclose (FILE *stream); |
/****************** this program shows opening and closing of a file using fclose api **************/
#include <stdio.h>
int main()
{
FILE *fp;
fp = fopen("c:\nput.txt", "w+");
if(fp == NULL)
{
printf("file opening failed");
return -1;
}
printf("file opened successfully: Perform file operations now\n");
if(!fclose(fp))
{
printf("file closed successfully");
return 0;
}
else
{
printf("file closing failed");
return -1;
}
}
Output
file opened successfully: Perform file operations now
file closed successfully
|
© 2005-2007 Nokia |