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

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -