Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save enqtran/78e9f1dea625c17d5cf49cb1325ce504 to your computer and use it in GitHub Desktop.

Select an option

Save enqtran/78e9f1dea625c17d5cf49cb1325ce504 to your computer and use it in GitHub Desktop.
The following are the most important functions used for this type of operation:
• fopen(): Opens a file
• fgets(): Reads the contents of a file, normally one line at a time
• fgetcsv(): Gets the current line from a CSV file and converts it into an array
• fread(): Reads a specified amount of a file
• fwrite(): Writes to a file
• feof(): Determines whether the end of the file has been reached
• rewind(): Moves the internal pointer back to the top of the file
• fseek(): Moves the internal pointer to a specific location in the file
• fclose(): Closes a file
- You may come across fputs() instead of fwrite(). the two functions are identical: fputs() is a
synonym for fwrite().
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment