Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

[beginner] C reading lines, and numbers

Name: Anonymous 2009-08-29 8:56

I have a file in which ever line of text is terminated with a number. I'd like to extract the text and the number to variables, how do I do that?

Name: Anonymous 2009-08-29 13:50


int num = 0;
char c;
while((c = getchar()) >= '0' && c <= '9'){
   num += (c - '0') * 10;
}

dus dis wurk?
to sav cher raray is easy. u dun ned me to do dat fur u

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List