what kind of files can we open using the files opening and writing concepts that we learnt in c | Sololearn: Learn to code for FREE!
Новый курс! Каждый программист должен знать генеративный ИИ!
Попробуйте бесплатный урок
+ 6

what kind of files can we open using the files opening and writing concepts that we learnt in c

like how can I use it in a practical way....which type of file content can I change using a c file

22nd Jun 2019, 5:49 PM
Sachin Motwani
Sachin Motwani - avatar
3 ответов
+ 9
A file is just a sequence of bytes. In text files a byte represents a character, and stdio.h provides convinience functions (fscanf, fprintf etc.) for reading and writing such files. However, using fread() and fwrite() to get and put bytes, you can edit any and all files. In audio files, the bytes represent frequencies and volume, in bitmap (picture) files, they represent pixel RGB values, in executable files they represent machine language instructions. How to parse the files depends on the specific format. You can usually find an abridged version of the specification on Wikipedia.
22nd Jun 2019, 5:57 PM
Vlad Serbu
Vlad Serbu - avatar
+ 3
You may also create your own file specification and create, read, write and update the contents. It is easier to update data using standard databases and calls designed to update them, but you can modify any file unless it is protected by the system. Typically OS program files are marked read only to prevent corruption which could damage the system. Fixed length text files are the easiest to update, but your format may be different. Practice file reads, writes and updates on example files first to be sure that your program works as expected before attempting to update any critical information.
29th Jun 2019, 10:47 AM
Roger Greenlaw
+ 1
C file functions are used to open any files that are not blocked from access by the operating system. The access methods include a binary format which permits access of non text data and text data as fixed length fields. The fields and record may be as small as one byte and the upper limit is based on the amount of free memory and operating system limitations. To access non text data you need to use a buffer in memory to hold the data to be read from or written to the file. C was used to create most of the Unix and Linux operating systems and some of the most popular applications in use in early systems such as Microsoft office applications and Open Office applications along with many popular games for PC and other systems before C++ and other more powerful languages were created. C++ makes the process of file access simpler, but C has always had the ability to read and write user defined file specifications including jpeg and tiff image files, spreadsheet files, text limited by programmer capability.
27th Oct 2019, 12:15 PM
Roger Greenlaw