Click here to Skip to main content
16,017,015 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionReading csv file -> Lil modification needed..... Pin
Software_Specialist24-Mar-07 15:13
Software_Specialist24-Mar-07 15:13 
AnswerRe: Reading csv file -> Lil modification needed..... Pin
Software_Specialist25-Mar-07 3:30
Software_Specialist25-Mar-07 3:30 
GeneralRe: Reading csv file -> Lil modification needed..... Pin
PJ Arends25-Mar-07 13:20
professionalPJ Arends25-Mar-07 13:20 
GeneralRe: Reading csv file -> Lil modification needed..... Pin
Stephen Hewitt25-Mar-07 14:32
Stephen Hewitt25-Mar-07 14:32 
GeneralRe: Reading csv file -> Lil modification needed..... Pin
PJ Arends25-Mar-07 17:00
professionalPJ Arends25-Mar-07 17:00 
AnswerRe: Reading csv file -> Lil modification needed..... Pin
Stephen Hewitt25-Mar-07 14:35
Stephen Hewitt25-Mar-07 14:35 
GeneralRe: Reading csv file -> Lil modification needed..... Pin
Software_Specialist26-Mar-07 10:21
Software_Specialist26-Mar-07 10:21 
GeneralRe: Reading csv file -> Lil modification needed..... Pin
Stephen Hewitt26-Mar-07 13:22
Stephen Hewitt26-Mar-07 13:22 
The sample I gave reads from the standard input stream; the file used is the console or a file if input redirection is used. To use a file specific file use code like this:
// CommandLine.cpp : Defines the entry point for the console application.
//
 
#include "StdAfx.h"
#include <iostream>
#include <fstream>
#include <string>
 
int main()
{
	using namespace std;
 
	// Open the file.
	ifstream file("C:\\File.txt");
	if (!file)
	{
		cerr << "Failed to open input file!" << endl;
		return 1;
	}
 
	// Read in the file line by line.
	unsigned int count = 0;
	string line;
	while (getline(file, line))
	{
		// Output the line number and the line itself.
		cout << "Line " << ++count << ": " << line << endl;
	}
 
	return 0;
}



Steve

GeneralRe: Reading csv file -&amp;gt; Lil modification needed..... Pin
Software_Specialist26-Mar-07 14:22
Software_Specialist26-Mar-07 14:22 
GeneralRe: Reading csv file -&amp;gt; Lil modification needed..... Pin
Stephen Hewitt26-Mar-07 14:32
Stephen Hewitt26-Mar-07 14:32 
GeneralRe: Reading csv file -&amp;gt; Lil modification needed..... Pin
Software_Specialist27-Mar-07 2:34
Software_Specialist27-Mar-07 2:34 
GeneralRe: Reading csv file -&amp;amp;gt; Lil modification needed..... Pin
Stephen Hewitt27-Mar-07 4:01
Stephen Hewitt27-Mar-07 4:01 
QuestionPPC (tmpstr) Index Numbering Pin
ZapMe124-Mar-07 11:30
ZapMe124-Mar-07 11:30 
QuestionActive interfaces [modified] Pin
deeps_cute24-Mar-07 9:38
deeps_cute24-Mar-07 9:38 
QuestionRe: Active interfaces Pin
Mark Salsbery25-Mar-07 9:02
Mark Salsbery25-Mar-07 9:02 
Questionhow many lines? Pin
Lord_Vader24-Mar-07 9:19
Lord_Vader24-Mar-07 9:19 
AnswerRe: how many lines? Pin
Christian Graus24-Mar-07 10:02
protectorChristian Graus24-Mar-07 10:02 
GeneralRe: how many lines? Pin
Lord_Vader24-Mar-07 10:06
Lord_Vader24-Mar-07 10:06 
GeneralRe: how many lines? Pin
Christian Graus24-Mar-07 12:39
protectorChristian Graus24-Mar-07 12:39 
GeneralRe: how many lines? Pin
Lord_Vader24-Mar-07 13:33
Lord_Vader24-Mar-07 13:33 
GeneralRe: how many lines? Pin
Christian Graus24-Mar-07 14:23
protectorChristian Graus24-Mar-07 14:23 
GeneralRe: how many lines? Pin
Gary R. Wheeler24-Mar-07 14:58
Gary R. Wheeler24-Mar-07 14:58 
QuestionRe: how many lines? Pin
Lord_Vader25-Mar-07 0:51
Lord_Vader25-Mar-07 0:51 
Questionprinting in OpenGL Pin
karim.samir@hotmail.com24-Mar-07 9:05
karim.samir@hotmail.com24-Mar-07 9:05 
QuestionChanging chart type in MS chart control Pin
webHamlet24-Mar-07 5:13
webHamlet24-Mar-07 5:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.