CSV file conversion...

From: Adam Balgach (ffld_at_hotmail.com)
Date: 11/23/04

Date: 22 Nov 2004 15:21:55 -0800

Greetings all, i am trying to parse up a CSV Comma delmited file from
microsoft (gasp) excel. And then use that data to convert it to
another file format (.arff). in any event, i am having a bunch of
trouble trying to get the individual lines. If i open the .csv in
emacs then it appears that there are eoln characters (/n) however,
when i attempt to use iostream::getline(char*, int, char) it seems to
be failing on finding the end of line. im using the code:

  ifstream input;
  if (!input.good()) {
     cerr << "Error opening\n";
  char line[1024];
  input.getline(line,1024,'\t'); //gets the first line in the file
  int pos=0;
  cout << "First Line: "<<line;

  what its basically doing is reading past the first end of line and
reading exactly 1024 characters. Has anyone worked with csv files
before? Please let me know. Thanks!


Relevant Pages

  • Re: Class definitions: VBA vs. VB .NET
    ... The moment a file, such as a .csv, is accessed, a lock is put on the file. ... I think you still may find that using an Excel to .csv model will cause ... Even with just one user accessing your data on your web server, ... the project I have been working on, membership records for a car club ...
  • Re: convert number to text without losing zeroes
    ... I am not opening the .csv file.. ... I believe excel brings each item in as a custom format if it is all numbers, ... in Excel converting it to a number and dropping the zero. ...
  • Re: Any working SIP-phone on FreeBSD?
    ... CSV, then import CSV into Excel, when the boss turns his/her back? ... and on the "Windows" platform (that the scrapped PCs ... I do not have high hopes for Skype in the future. ...
  • Re: convert number to text without losing zeroes
    ... use a custom format of 000000, then those leading zeros are preserved when excel ... saves the file as a .CSV file. ... treated as a number but retains the zero. ...
  • Re: CSV
    ... Excel is generally ... Multiline CSV definitely have a right to exist: ... fields in this, and only this format. ... "Multiline CSV" is something I've ...