Click here to Skip to main content
15,902,492 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Sliderbar problem Pin
zqueezy20-May-07 2:31
zqueezy20-May-07 2:31 
AnswerRe: Sliderbar problem Pin
Mark Salsbery20-May-07 6:53
Mark Salsbery20-May-07 6:53 
QuestionIPaddress control-please help me Pin
prathuraj19-May-07 21:04
prathuraj19-May-07 21:04 
AnswerRe: IPaddress control-please help me Pin
Arman S.19-May-07 21:07
Arman S.19-May-07 21:07 
GeneralRe: IPaddress control-please help me Pin
prathuraj19-May-07 21:16
prathuraj19-May-07 21:16 
GeneralRe: IPaddress control-please help me Pin
Manoj Kumar Rai20-May-07 9:20
professionalManoj Kumar Rai20-May-07 9:20 
AnswerRe: IPaddress control-please help me Pin
David Crow21-May-07 3:49
David Crow21-May-07 3:49 
QuestionI can't load file txt by using CStdioFile Pin
whale8419-May-07 17:54
whale8419-May-07 17:54 
I want to read line by line in a text file by using CStdioFile .But I have some problem when my application run.VC++ notice a error messages.Please help me to fix where wrong in my code.Here is my code :
<br />
void CTestForm::LoadFile()<br />
{<br />
	TRY<br />
	{<br />
		CStdioFile file("cauhoi.txt", CFile::modeRead|CFile::typeText);<br />
		CArchive ar( &file, CArchive::load );<br />
		CString data;<br />
<br />
		BOOL finished = FALSE;<br />
<br />
		while (!finished)<br />
		{<br />
			CQuestionData * pQues = new CQuestionData();<br />
			pQues->Serialize(ar);<br />
			if (pQues->GetData() == "")		<br />
			{<br />
				delete pQues;<br />
				finished = TRUE;<br />
			}<br />
		}<br />
		ar.Close();<br />
	}<br />
	CATCH( CFileException, cfe)<br />
	{<br />
	}<br />
	CATCH(CMemoryException, cme)<br />
	{<br />
		cme->ReportError();<br />
	}<br />
	CATCH(CArchiveException, cae)<br />
	{<br />
	}<br />
	END_CATCH<br />
}<br />
void CQuestionData::Serialize(CArchive &ar)<br />
{<br />
	CObject::Serialize(ar);<br />
<br />
	if(ar.IsStoring())<br />
	{<br />
	}<br />
	else<br />
	{<br />
		// TODO: add loading code here<br />
		if (!ar.ReadString(data))<br />
		{<br />
			return;<br />
		}<br />
		ar.ReadString(data);<br />
		while(data != "")<br />
		{<br />
			if(data == "#Q")<br />
			{<br />
				m_count++;<br />
				ar.ReadString(data);<br />
				m_sQues = data;<br />
				ar.ReadString(data);<br />
			}<br />
			else if(data == "#A")<br />
			{		<br />
				ar.ReadString(data);<br />
				while(data != "#Q")<br />
				{<br />
					m_arrAns[dem++] = data; <br />
					ar.ReadString(data);<br />
				}<br />
			}<br />
			<br />
		}<br />
<br />
	}<br />
}<br />


nothing

QuestionRe: I can't load file txt by using CStdioFile Pin
Hamid_RT19-May-07 19:07
Hamid_RT19-May-07 19:07 
QuestionRe: I can't load file txt by using CStdioFile Pin
bob1697219-May-07 19:40
bob1697219-May-07 19:40 
AnswerRe: I can't load file txt by using CStdioFile Pin
bob1697219-May-07 19:49
bob1697219-May-07 19:49 
GeneralRe: I can't load file txt by using CStdioFile Pin
whale8419-May-07 21:42
whale8419-May-07 21:42 
QuestionRe: I can't load file txt by using CStdioFile Pin
David Crow21-May-07 3:51
David Crow21-May-07 3:51 
QuestionCan't open project workspace Pin
Max++19-May-07 17:08
Max++19-May-07 17:08 
QuestionRe: Can't open project workspace Pin
Hamid_RT19-May-07 19:47
Hamid_RT19-May-07 19:47 
AnswerRe: Can't open project workspace Pin
GuyM19-May-07 20:16
GuyM19-May-07 20:16 
GeneralRe: Can't open project workspace Pin
Max++19-May-07 20:23
Max++19-May-07 20:23 
GeneralRe: Can't open project workspace Pin
Max++19-May-07 22:07
Max++19-May-07 22:07 
GeneralRe: Can't open project workspace Pin
GuyM20-May-07 0:00
GuyM20-May-07 0:00 
QuestionClear ListBox Pin
Star0919-May-07 14:48
Star0919-May-07 14:48 
AnswerRe: Clear ListBox Pin
led mike19-May-07 17:16
led mike19-May-07 17:16 
GeneralRe: Clear ListBox Pin
Star0919-May-07 18:04
Star0919-May-07 18:04 
GeneralRe: Clear ListBox Pin
Rajesh R Subramanian19-May-07 22:44
professionalRajesh R Subramanian19-May-07 22:44 
AnswerRe: Clear ListBox Pin
Immunity1819-May-07 23:52
Immunity1819-May-07 23:52 
QuestionExtract a string from another, C++ Pin
C_Zealot19-May-07 14:42
C_Zealot19-May-07 14:42 

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.