how we can upload our data from disk to c programming

–4 votes
asked Jan 24 by anonymous
How we can upload data from disk to c programming

2 Answers

0 votes
answered Feb 6 by Nando Abreu (930 points)

You tagged Python, please correct.

0 votes
answered Feb 14 by anonymous
Read from files that have a file pointer to a buffer stream within C to able to access. Can also write/append back to disk.

Some functions for reading that can be used are fgets, fgetc, feof and fread.

Modes to read for normal txt files = r, r+, w+ and a+. If the file is a binary file (.bin), use rb, rb+, wb+ and ab+

Have to open a file to be able to read etc. When changing modes, need to close then reopen. Remember to close the file pointer after use.

#include <stdio.h>

void main(){

FILE *pointername;

pointername = fopen("name and possibly path if required with mount point", "mode");

Read etc.


Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.