Reading in data from a string in C (like scanf)?

Perhaps check out sscanf It is just like it's cousin scanf and fscanf but takes a string instead. Here is a snip from the above link.

Perhaps check out sscanf. It is just like it's cousin scanf and fscanf but takes a string instead. Here is a snip from the above link.

The sscanf function accepts a string from which to read input, then, in a manner similar to printf and related functions, it accepts a template string and a series of related arguments. It tries to match the template string to the string from which it is reading input, using conversion specifier like those of printf.

Ahhhh! Thanks a lot, sscanf didn't seem to come up in my searches, this is exactly what I need. – Durand Feb 2 at 18:15.

You can use the strtok function read the manpage to split a string e.g. gnu.org/s/libc/manual/html_node/Finding-....

Thanks, this is quite useful, I'll probably use this in the future but I think using sscanf() is probably a simpler option in C whereas I chose to use split() in python because it was the simpler choice there. – Durand Feb 2 at 18:17 @Durand you can do a similar thing in python -- also, the python code you gave doesn't automatically interpret the fields as integers – Foo Bah Feb 2 at 18:47 Yeah, you would need to use: firsti, secondi, thirdi, forthi, fifthi = int(i) for in line. Split('\t') – Durand Feb 2 at 20:18.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions