Proper way to read ELF files in C -
first time posting here, googled few hours , couldn't find anything.
i trying write client program reads different files , sends them on web server program. (for backup purposes.)
so far have used fread() put files buffer, in way similar this: http://www.cplusplus.com/reference/clibrary/cstdio/fread/
it works fine plain-text files, when try transfer executable files, fread() doesn't seem read files, reading "elf" buffer.
my question is, proper way read contents of elf file buffer in c?
thank you.
the proper way read binary files use fread()
. remember cannot treat contents string, means (among other things) cannot use strlen()
determine length.
instead, must keep length in seperate variable. return value of fread()
tell how many records read - if set record size 1 (the second parameter fread()
) return number of bytes read.
Comments
Post a Comment