Click here to Skip to main content
15,943,089 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Accessing private members of a base Class Pin
ForNow5-Jul-07 16:14
ForNow5-Jul-07 16:14 
GeneralRe: Accessing private members of a base Class Pin
Joe Woodbury5-Jul-07 16:19
professionalJoe Woodbury5-Jul-07 16:19 
GeneralRe: Accessing private members of a base Class Pin
ForNow5-Jul-07 16:25
ForNow5-Jul-07 16:25 
QuestionRead lines in a file Pin
Perspx4-Jul-07 11:06
Perspx4-Jul-07 11:06 
AnswerRe: Read lines in a file [modified] Pin
Cyrilix4-Jul-07 11:24
Cyrilix4-Jul-07 11:24 
AnswerRe: Read lines in a file Pin
Akt_4_U4-Jul-07 18:44
Akt_4_U4-Jul-07 18:44 
AnswerRe: Read lines in a file Pin
Hamid_RT4-Jul-07 19:35
Hamid_RT4-Jul-07 19:35 
AnswerRe: Read lines in a file Pin
Stephen Hewitt5-Jul-07 13:04
Stephen Hewitt5-Jul-07 13:04 
I'd do it like this:
--------------------

// Console.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <string>
#include <iostream>
#include <fstream>

int main(int arvc, char* argv[])
{
using namespace std;

ifstream ifs("C:\\Data.txt");
if (!ifs)
{
cerr << "Failed to open file!" << endl;
return 1;
}

int line_count = 0;
string line;
while (getline(ifs, line))
{
cout << "Line " << ++line_count << ": " << line << endl;
}

return 0;
}


Steve
GeneralRe: Read lines in a file Pin
Perspx5-Jul-07 18:37
Perspx5-Jul-07 18:37 
QuestionProcess Priority Pin
Perspx4-Jul-07 10:17
Perspx4-Jul-07 10:17 
AnswerRe: Process Priority Pin
Michael Dunn4-Jul-07 13:02
sitebuilderMichael Dunn4-Jul-07 13:02 
AnswerRe: Process Priority Pin
Randor 4-Jul-07 13:39
professional Randor 4-Jul-07 13:39 
AnswerRe: Process Priority Pin
Hamid_RT4-Jul-07 19:36
Hamid_RT4-Jul-07 19:36 
GeneralRe: Process Priority Pin
Perspx5-Jul-07 7:03
Perspx5-Jul-07 7:03 
GeneralRe: Process Priority Pin
Hamid_RT6-Jul-07 0:52
Hamid_RT6-Jul-07 0:52 
QuestionPassing Handles Pin
tom groezer4-Jul-07 10:13
tom groezer4-Jul-07 10:13 
AnswerRe: Passing Handles Pin
David Crow5-Jul-07 3:07
David Crow5-Jul-07 3:07 
QuestionGeneral DLL questions Pin
ForNow4-Jul-07 9:52
ForNow4-Jul-07 9:52 
QuestionMultiple inheritance in MFC Pin
tom groezer4-Jul-07 9:28
tom groezer4-Jul-07 9:28 
AnswerRe: Multiple inheritance in MFC Pin
Mark Salsbery4-Jul-07 9:31
Mark Salsbery4-Jul-07 9:31 
GeneralRe: Multiple inheritance in MFC Pin
tom groezer4-Jul-07 10:19
tom groezer4-Jul-07 10:19 
GeneralRe: Multiple inheritance in MFC Pin
David Crow5-Jul-07 3:13
David Crow5-Jul-07 3:13 
GeneralRe: Multiple inheritance in MFC Pin
Mark Salsbery5-Jul-07 10:54
Mark Salsbery5-Jul-07 10:54 
Questionhow to use "OnNewDocument" from cview or cmainframe class Pin
chaitannya_m4-Jul-07 9:18
chaitannya_m4-Jul-07 9:18 
AnswerRe: how to use "OnNewDocument" from cview or cmainframe class Pin
Mark Salsbery4-Jul-07 9:47
Mark Salsbery4-Jul-07 9:47 

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.