c - Colon separated contents in a text file -
i need c program can read contents text file , contents in file colon separated shown
catid;1;catname;cloths;prefix;ch;activestatus;y;......
so can 1 suggest best , simple logic read contents , store in buffer?
thanks in advance
i'm not sure if it's best way would:
- use
fgets
read file line line - use
strtok
tokenize string (or manually depending on how lazy feel)
something this:
char *p; while (fgets(line, maxline, fp)) { p = strtok(line, ";"); while (null != p) { /* p token */ p = strtok(null, ";"); } }
Comments
Post a Comment