>Definately not the same as gets.
It was the way Stoned wrote it
-Prelude
>Definately not the same as gets.
It was the way Stoned wrote it
-Prelude
My best code is written with the delete key.
Of course, no one in their right mind would use scanf that way anyway so I guess the point is moot. The only times I've seen that scanf construct has been in response to a question either here or Usenet. Never in production code.
-Prelude
My best code is written with the delete key.
Those formatters are not used in scanf but they are used in sscanf, after a string is retrieved with fgets. Take this senario
39408234030482na me83048019384039842309
42340982349823na me23904823908402384239
43493842030948na me8432d039849023893944
I want 2 floats a string and 2 ints. This datafile is used by 2 different programs. The data unrelated to the program that I'm currently using must be skipped. I will grab the line with fgets and use those formatters to retrieve my desired fields with sscanf right into my structure. That's production code. You will find this if you look into Cobol. Most large scale systems in the world are Cobol. C can accomplish the same thing. Try looking into business applications, not games. In production code, infact they do not even use decimals for floating point numbers on the datafile. It is all just numbers and the programmer has to format the data, all decimal places are virtual or implied. The datafiles just look like a mess of numbers packed together. And like I mentioned, more than one program will use the same datafile, therefore characters must be skipped in order for the structure to accept the correct fields that it needs in contrast to another program with a different structure with different fields using the same file.
Last edited by Troll_King; 02-10-2002 at 04:32 PM.
10,000 ways to do the same thing *sigh*
Now I think I'll look into the console function. It sounds exactly like what I'm looking for. Especially since it can even format numbers. Just think, I was trying to understand the locale.h, confusing stuff.
Thanks for all the information, it's been extremely helpful.
Last edited by Invincible; 02-10-2002 at 04:47 PM.
"The mind, like a parachute, only functions when open."