[Home]
[Edit this page]
[Recent Changes]
[Special Pages]
[Help]
Zeev Suraski » CppReturn » CppSeagull » compression » midlet » CLinkingError » CppConstructor » PCI-X » WirelessToolKit » CompareCppBuilderWithDelphi » CFopen
The options of fopen are:
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
Zeev Suraski » CppReturn » CppSeagull » compression » midlet » CLinkingError » CppConstructor » PCI-X » WirelessToolKit » CompareCppBuilderWithDelphi » CFopen
(C) fopen
'File Open', a function used in file I/O.Example
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; }
- include <stdio.h>
- include <assert.h>
The options of fopen are:
+----+------------------------------------------------------+ | r | open for reading | | w | open for writing (file need not exist) | | a | open for appending (file need not exist) | | r+ | open for reading and writing, start at beginning | | w+ | open for reading and writing (overwrite file) | | a+ | open for reading and writing (append if file exists) | +----+------------------------------------------------------+
'fopen' links
Code links
[Edit this page] [Page history] [What links here] [Discuss this topic] [Printer Friendly]
