C Useful


File



Get The Absolute File Path

( man 3 realpath )

Get The Absolute Real File Path Of Current Binary

( man 2 readlink | MSDN GetModuleFileName )

Check If A File Exists

( man stat | man fopen )

Move (Or Rename) A File

( man 2 rename )

Delete A File

(Without Check If File Exists)
( man 2 unlink | man remove )

Get A File Size

(Return File Size In Bytes)
( man stat | man ftell )

Read A Line Of Text File

(Before Open The File With "fopen" Function And Argument "r")
Warning: For UTF-8 (Or Other) Characters...

( man fgets | man fgetc | man ferror )

Patch A File (Replace Values On A File)

(Warnings: With 32bits Program / File Size Limit And UTF-8 (Or Other) Characters...)
( man fopen | man fprintf | man fseek )

Parse A HTML (Or HTM) File As XML

(LibXML2 Library -> libxml2 Is Required)
( http://xmlsoft.org/ )

An Example To Compress/Decompress A File

(Zlib Library -> libz Is Required)
( https://zlib.net/ )