Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Library : Other (not classified elsewhere) » How to read from and write to a table in a file (CSV)?
Re: How to read from and write to a table in a file (CSV)? [message #10339 is a reply to message #10325] Tue, 03 July 2007 09:23 Go to previous messageGo to previous message
$mike{is_here} is currently offline  $mike{is_here}
Messages: 12
Registered: July 2007
Promising Member
Hi Mirek,

Thanks, I used most of your ideas.


Dear all,

Because this post seems to catch some interest please find attached my solution (XP's zip). The functions

String 		cleanup(String s);
Vector<String>	getLines(String s);
String 		load(char* filename);
bool 		save(const char *filename, const String& data);
String 		ToString(const Vector<String>& vs);
Vector<String>	transpose(const Vector<String>& vs);


help to convert input.txt

 A,	B  , 	 C		,D	
1,10  ,   100,	5
		2,20 , 200,55



into output.txt

A,1,2
B,10,20
C,100,200
D,5,55



Any suggestion, feedback or comments are welcome. This code so far does just the required minimum. I.e. it will fail when the number of elements vary. I wonder how to take care of such issues, e.g. through throwing exceptions (try, catch) or else?

What would you do?

Kind regards,
Micha
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Opening window during Drag-Drop crashes app.
Next Topic: Geom/PlotterCtrl fixed plot
Goto Forum:
  


Current Time: Thu May 16 15:13:58 CEST 2024

Total time taken to generate the page: 0.02069 seconds