Click here to Skip to main content
15,887,485 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: CTreeCtrl Problem Pin
Parthi_Appu16-Apr-07 18:26
Parthi_Appu16-Apr-07 18:26 
AnswerRe: CTreeCtrl Problem Pin
syampj16-Apr-07 20:47
syampj16-Apr-07 20:47 
AnswerRe: CTreeCtrl Problem Pin
skornel17-Apr-07 2:27
skornel17-Apr-07 2:27 
QuestionNot access to child dialog object... Assert Error.. Pin
aquawicket16-Apr-07 16:59
aquawicket16-Apr-07 16:59 
AnswerRe: Not access to child dialog object... Assert Error.. Pin
aquawicket16-Apr-07 17:32
aquawicket16-Apr-07 17:32 
Questioncrypto and stego..? Pin
Software_Specialist16-Apr-07 13:11
Software_Specialist16-Apr-07 13:11 
AnswerRe: crypto and stego..? Pin
Dmitry Khudorozhkov16-Apr-07 14:37
Dmitry Khudorozhkov16-Apr-07 14:37 
Questiongetline help Pin
arbster116-Apr-07 10:56
arbster116-Apr-07 10:56 
Hello everybody, I'm writing a program to take the contents for several .txt files and make them into one single .txt file. The separate txt files have to go in the single file at a certain order.
The problem with the code (see below) is that when I call getline(file,bline), bline is left empty after the call I don't understand what could be the problem. The file opens properly according to file.is_open but getline doesn't read. Here is the code:

<br />
<br />
	fstream file;<br />
	<br />
	string bline;<br />
	int i,j;<br />
	<br />
	<br />
	string month[]={"01","02","03","04","05","06","07","08","09","10","11","12"};//these are all the months in the files<br />
	string year[]={"1999","2000","2001","2002","2003","2004","2005","2006"};//and these are all the years<br />
	<br />
          for(j=0;j<=7;j++)<br />
		for(i=0;i<=11;i++)<br />
		{<br />
			string fname="E:\\Month\\"+month[i]+"_"+year[j]+".txt";<br />
			<br />
			file.open(fname.c_str());<br />
			if(file.is_open()){<br />
				<br />
				while(!file.eof()){<br />
					ofstream ofile;<br />
					ofile.open("C://allfile.txt",ios::app);<br />
					getline(file,bline);<br />
					ofile<<year[j]<<'\t'<<month[i]<<'\t'<<bline<<endl;<br />
				}<br />
			<br />
				cout<<"Finished month "<<i+1<<" year "<<j+1999<<endl;<br />
<br />
			}<br />
			else<br />
				cout<<"Cant open file"<<endl;<br />
<br />
			<br />
		}<br />

AnswerRe: getline help Pin
toxcct16-Apr-07 11:08
toxcct16-Apr-07 11:08 
GeneralRe: getline help Pin
arbster116-Apr-07 11:10
arbster116-Apr-07 11:10 
GeneralRe: getline help Pin
toxcct16-Apr-07 11:14
toxcct16-Apr-07 11:14 
AnswerRe: getline help Pin
Stephen Hewitt16-Apr-07 18:08
Stephen Hewitt16-Apr-07 18:08 
GeneralRe: getline help Pin
toxcct16-Apr-07 20:28
toxcct16-Apr-07 20:28 
GeneralRe: getline help Pin
Stephen Hewitt16-Apr-07 20:34
Stephen Hewitt16-Apr-07 20:34 
AnswerRe: getline help Pin
wucy121316-Apr-07 18:12
wucy121316-Apr-07 18:12 
QuestionVS2005 Component Gallery Pin
DRHuff16-Apr-07 10:55
DRHuff16-Apr-07 10:55 
AnswerRe: VS2005 Component Gallery Pin
Arman S.16-Apr-07 20:36
Arman S.16-Apr-07 20:36 
QuestionAccessing windows user account properties Pin
ramesh_hp200616-Apr-07 10:22
ramesh_hp200616-Apr-07 10:22 
QuestionRe: Accessing windows user account properties Pin
sthotakura16-Apr-07 11:19
sthotakura16-Apr-07 11:19 
QuestionCOM classes and pointers Pin
prithaa16-Apr-07 8:47
prithaa16-Apr-07 8:47 
AnswerRe: COM classes and pointers Pin
sthotakura16-Apr-07 8:50
sthotakura16-Apr-07 8:50 
GeneralRe: COM classes and pointers Pin
prithaa16-Apr-07 9:11
prithaa16-Apr-07 9:11 
AnswerRe: COM classes and pointers Pin
sthotakura16-Apr-07 9:29
sthotakura16-Apr-07 9:29 
GeneralRe: COM classes and pointers Pin
prithaa16-Apr-07 18:57
prithaa16-Apr-07 18:57 
GeneralRe: COM classes and pointers Pin
sthotakura16-Apr-07 21:03
sthotakura16-Apr-07 21:03 

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.