Can anyone give me a general idea on searching structs in files?
For example:
Let's say I have a struct-type "flower".
PHP Code:
struct flower{
char common_name[100];
char scientific_name[100];
char color[50];
};
Now suppose I want to search a file filled with these structs by "common_name" so that I may obtain the "scientific_name" of that flower. Or perhaps search all structs of a certain "color" in order to print out the "common_name"s of all matching flowers.
First of all, I do not understand how, if at all, these structs are distinguished at all from simply plain data, since opening a plain-text file of a group of these structs simply shows data, without any "markings" indicating they ARE indeed structs...? Very weird.
So I am guessing I will have to master "fseek()", "ftell()", et al, in order to "impose" a distinguishability between plain data and structs stored in files, but all the books I have just gleen over this information very quickly.
Anyway, that's a long-winded explanation of this newbies current difficulties.
All, advice, examples, and dissertations are welcome, no matter how abstract!
Thanks