C++ code to download csv file






















Thanks guys. If what you're really doing is manipulating a CSV file itself, Nelson's answer makes sense. However, my suspicion is that the CSV is simply an artifact of the problem you're solving. Read and write a single row at a time, rather than keeping a complete in-memory representation of the file itself. There are a few obvious benefits:. Usually, the rule is that they will be 'protected' because the field will be double-quote delimited, as in "Boston, MA ". Other sources will.

Others will delimit all fields, even numerics. Sometimes it'll be just a CR. The field will usually be double-quote delimited, but this situation is very difficult to handle. Believe me when I say this - investing your time into learning how to make libraries, especially those dealing with the loading, manipulation and saving of data, will not only remove your dependence on the existence of such libraries but will also make you an all-around better programmer.

I don't know how much you already know about string manipulation and parsing; so if you get stuck I would be happy to help. Here is some code you can use.

The data from the csv is stored inside an array of rows. Each row is an array of strings. Hope this helps. Using boost tokenizer to parse records , see here for more details. But it would be worth reading the book even if you don't use the code. CSV to C structure utility. Naturally, you can't make changes to the CSV file, but if you just need in-memory read-only access to the data, it could work.

Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more. Asked 12 years, 10 months ago.

Active 6 years, 3 months ago. Viewed k times. The download contains documentation and sample programs. You can check it out at sourceforge. How do you expect to get more rep if you give answers as comments, Robert? You can also convert CSV into many other file formats including few listed below. Products Aspose. Visit our documentation for more details.

Call the Save method. Pass the output file path with XLSX file extension. XLSX file will be saved at the specified path. Open XLSX file in compatible program. Save Article. Improve Article. Like Article. Recommended Articles. Write a C program that displays contents of a given file like 'more' utility in Linux.

Article Contributed By :. Easy Normal Medium Hard Expert. Writing code in comment? Please use ide. Load Comments.



0コメント