A
Alex
The input contains two strings alphanumeric ASCII characters separated
by whitespace. Input is terminated by EOF.
by whitespace. Input is terminated by EOF.
The input contains two strings alphanumeric ASCII characters separated
by whitespace. Input is terminated by EOF.
Alex said:The input contains two strings alphanumeric ASCII characters separated
by whitespace. Input is terminated by EOF.
Alex said:The input contains two strings alphanumeric ASCII characters separated
by whitespace. Input is terminated by EOF.
Chris Dollin said:(If EOF didn't terminate it, it wouldn't be called *E*OF; it seems a bit
redundant to say that.)
So the input is required to have no line-end characters?
Richard said:Where do you read that?
Chris said:Because the spec doesn't appear to allow it:
There's nothing in there that allows whitespace (of which end-of-line,
aka \n, is an instance) after the second alphanumeric string.
It's probably a buggy specification, although some people might take
the position that it's a picky reading.
Alex said:The input contains two strings alphanumeric ASCII characters separated
by whitespace. Input is terminated by EOF.
Alex said:The input contains two strings alphanumeric ASCII characters separated
by whitespace. Input is terminated by EOF.
Konstantin said:man sscanf or google sscanf
double a, b;
if( 2 != sscanf(input, "%lf %lf", &a, &b) ) printf("error\n");
kondal said:Alex said:The input contains two strings alphanumeric ASCII characters separated
by whitespace. Input is terminated by EOF.
char buf[1000]="";
int len = 1000; /*length of the strings combined. */
fread(buf, len, 1, stdin);
Then use strtok to get the individual strings.
Hope this works!
kondal said:kondal said:Alex said:The input contains two strings alphanumeric ASCII characters separated
by whitespace. Input is terminated by EOF.
char buf[1000]="";
int len = 1000; /*length of the strings combined. */
fread(buf, len, 1, stdin);
Then use strtok to get the individual strings.
Hope this works!
if the length of the strings isn't known, you can read and fill the
buffer till eof is reached using feof function.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.