OT: fscanf

Started by
1 comment, last by penetrator 21 years, 3 months ago
fscanf( stream2, "%24c", max_elev); The above instruction reads 24 chars into max_elev. How can i specify a variable number of chars to be read ? Something like int numberofchars=24; fscanf(........ ?????
www.web-discovery.net

Advertisement
Try the following:

int size = 24;
char sz[256];
sprintf(sz, "%%dc", size);
fscanf(stream2, sz, max_elev);

That might work, tho I can''t besure.
------------------------"If it says it loves me, how can it be a virus?"
why not just do like
char line[24];

fgets(line, 24, stream2);

This topic is closed to new replies.

Advertisement