CFclose

(C) fopen

'File Close', a function used in file I/O.

Example

  1. include <stdio.h>
  2. include <assert.h>
int main(void) { FILE * pFile = 0; char myText[100]; /* Open the file myFile.txt for writing */ pFile = fopen ("myFile.txt","w"); /* Assume file has been opened succesfully */ assert(pFile != 0); /* Prompt for input */ puts("please type some text:"); /* Get the input in the character buffer 'myText'*/ gets(myText); /* Write character buffer 'myText' to file */ fprintf (pFile, "Your text: %s\n",myText); /* Close the file */ fclose (pFile); return 0; }


'fclose' links

Code links



last edited (November 29, 2006) by bilderbikkel

Back to the page