hi i was wondering how to import a .csv file and save it to a memory buffer of doubles and print the contents of the .cvs file
hi i was wondering how to import a .csv file and save it to a memory buffer of doubles and print the contents of the .cvs file
Find a C library for parsing files/strings in CSV formats.
If you're only talking about a specific CSV format that has a fixed number of floating point values per line to be stored as doubles, then fscanf might be good enough.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
A CSV file format is quite simple, after all it stands for "Comma Separated Values". The first row is typically the names of the different columns, and all of the following rows are data. Remember that it may not only contain numbers.
A word of caution though, CSV files are... inconsistent when it comes to line endings. Some use '\n', others use '\r\n' and others still just use '\r'. In the last case, I don't know if C converts it to a '\n' or not.
Devoted my life to programming...
Not as simple as it sounds, refer to this wikipedia post and the RFC 4180.
I think the recommendation of @laserlight makes sense, unless someone is interested in createing its own set of routines...
Is a .cvs file what the pharmacy uses to print the really, really long receipts?