Emmanuel Delahaye wrote:
Shivani wrote on 01/09/05 :
I am looking for a utility that reads hexadecimal numbers from a file
into a string. The numbers in the file are seperated by "," as
delimeter. Is there a standard C utility that can do that?
If you want to read a line of text, use fgets(). Then you can get the
data from the line with sscanf() of strtol().
Time to open your C-book.
Opening the C-book is always a good suggestion. And keep it open. As I
look around here at home, I see K&R1, K&R2 and H&S5 in view.
The reading of a data file is always treacherous in C. You must know
precisely the format of the file, binary or text, etc.
If you don't know it exactly you are doomed from the outset.
Usage of *scanf() presumes a 'text' file that you know the exact format of.
Usage of fgets() presumes a 'text' file of 'lines'. It allows you to
test the line in any way you like before you assign its contents
somewhere. I like fgets().
If you play with pure 'binary' files, database tables, indexes, etc.,
you are really on your own. You must know the format exactly and be
prepared to write your own functions for extacting strings or whatever.
The Standard C Library is of little use with .PDF or other such files.
--
Joe Wright
"Everything should be made as simple as possible, but not simpler."
--- Albert Einstein ---