C programming read double from file


















Active 4 months ago. Viewed times. And why the temporary double array? Why not read directly into the float array? Why all the casting? Don't cast unless you need it. Add a comment. Active Oldest Votes. Sign up or log in Sign up using Google. There are blank lines present at the end of the file. In our program, we have opened only one file. You can open multiple files in a single program, in different modes as required.

File handling is essential when we wish to store data permanently on a storage device. All variables and data of a program are lost when it terminates. After you compile and run the above c program to read text from a file and display , your C compiler asks you to enter the filename to read the text and display. After you enter a. Programming C Programming.

Share on Facebook. I've tried using other methods of reading the file which have also been ineffective. Any help is welcome, Thanks. Tomer Li-ran. Tomer Li-ran Tomer Li-ran 11 1 1 silver badge 6 6 bronze badges. Post your input file too Have you tried to step through the code line by line in a debugger?

I posted my input file too, yeah I've tried debugging but I'm not sure exactly it seems to skip the start of the while loop. Post a minimal reproducible example please.

What you have looks fine so far, your error is elsewhere. What is your locale language setting? Maybe your system uses comma as the decimal separator?

Show 6 more comments. Active Oldest Votes. Thanks for the help anyway everyone!



0コメント

  • 1000 / 1000