http://web.archive.org/web/200502070...t.html#4.9.6.2
[edit]
Code:
#include <stdio.h>
int main(void)
{
static const char filename[] = "file.txt";
FILE *file = fopen(filename, "r");
if ( file != NULL )
{
char line[BUFSIZ];
while ( fgets(line, sizeof line, file) != NULL )
{
char one[20], three[22], five[18];
if ( sscanf(line, "%19s %*s %21s %*s %17s", one, three, five) == 3 )
{
printf("one = \"%s\", three = \"%s\", five = \"%s\"\n",
one, three, five);
}
}
}
else
{
perror(filename);
}
return 0;
}
/* my output
one = "1234", three = "qwert", five = "hgy7"
one = "2323", three = "fghjj", five = "dwe3"
*/