OK, every line of data that has no number with a decimal point, can be written out exactly as it is -- fgets() will do that exactly for you.
Every line WITH a decimal point in it, needs to be rounded off at the sixth significant digit - that's also easy to do, with fgets().
Say I have this line of data:
10, -180, 3.14159265358979, 11.899
resulting in a data array of:
Code:
char data[124]={10, -180, 3.14159265358979, 11.899};
Thank you , so coming to my new code the build is fine but when I debug , it gives me a run time error and nothing else , the program just freezes , it doesn't go through the code I guess. As far as I think I'm definitely not doing the rounding rite or for a pointer to scan the file. Can you please tell me what I need to add to it .
because my file is a data of about 100 lines, so I need it to go through every line and just change the decimal point to rounded 6 significant digits.
Can you emphasize a little more on what you explained .
Thank you
How would you round off the third number, as needed?
Clearly, if you use a for loop, you can check each digit, and locate the decimal point, and get it's index location. Also clearly, you can then use that index + 6, to locate the last significant digit.
I can't emphasize this enough: I would assume that your newest code is an improvement - that is NO help to us. What I need to help you, is WHAT PROBLEM YOU ARE HAVING WITH THAT CURRENT CODE - SPECIFICALLY!
I'm not going to run your code against an assortment of possible data files to figure out what you should be telling me. We need to be efficient here, and not waste time.