0

How I save datas of archive to array in c?

6th Jun 2019, 12:33 AM
Renato Silva
Renato Silva - avatar
3 Antworten
0
What archive?
6th Jun 2019, 1:01 PM
Vlad Serbu
Vlad Serbu - avatar
0
Docs with extension .txt, .ppm..
6th Jun 2019, 2:22 PM
Renato Silva
Renato Silva - avatar
0
Use <studio.h> to open the file (fread()) and read it (fread()). https://en.cppreference.com/w/c/io A file is just a sequence of bytes, and fread will put size*count bytes in the buffer. The buffer can be, for example, an array of chars (since a char is a byte). The rest of <stdio.h> provides helper functions for reading text files. To read other files (like image files), you can use a library, or find the format specification, which will tell you should interpret the bytes, if you want to do it manually.
6th Jun 2019, 3:01 PM
Vlad Serbu
Vlad Serbu - avatar