| | |
Displaying comma in .csv fille
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Jul 2008
Posts: 20
Reputation:
Solved Threads: 0
I am saving the output of my program in .csv file.
I need to save a variable's value in one column, but the value may contain comma.
When the program encounters a comma it places half of the variable's value in
the next column.
Is there any way through which I can avoid the placement of value in the next column..
I need to save a variable's value in one column, but the value may contain comma.
When the program encounters a comma it places half of the variable's value in
the next column.
Is there any way through which I can avoid the placement of value in the next column..
Interesting that you want to use a format specifically meant for separating individual values with commas, but need to retain information with commas inside it.
A good way of doing this would be to make your own tokenizer and only parse information when a stack is empty.
When you encounter quotes, push it onto the stack and read characters contiguously, even if it is a comma.
When you encounter quotes again, pop the original quote off of the stack and let your custom tokenizer do its thing, like normal.
A good way of doing this would be to make your own tokenizer and only parse information when a stack is empty.
When you encounter quotes, push it onto the stack and read characters contiguously, even if it is a comma.
When you encounter quotes again, pop the original quote off of the stack and let your custom tokenizer do its thing, like normal.
![]() |
Other Threads in the C++ Forum
- Previous Thread: help with variable
- Next Thread: reading a file in hex
| Thread Tools | Search this Thread |
api array arrays based beginner binary c++ c/c++ calculator char char* class classes code compile compiler console conversion count delete deploy desktop directshow dll download dynamic dynamiccharacterarray encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory news number numbertoword output parameter pointer problem program programming project python random read recursion recursive reference return rpg sorting string strings struct temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets






