Hello guys, by the way I am a newbie here. This is my first post in this forum. I am now doing a window application(MFC.exe-dialog based) using the Microsoft Visual C++ 6 Enterprise Edition. Actually I am doing the simple application that read a string from text file. I only can read the whole text file using CStdio. But for now, I have stuck in reading the character in the text file line by line following the comma separated as the delimiter. This is the sample of the text file to be read:

VARS.V1, VARS.V1_B,
VARS.V2, VARS.V2_B,
VARS.V3, VARS.V3_B,
VARS.V4, VARS.V4_B,
VARS.V5, VARS.V5_B,
VARS.V6, VARS.V6_B,
VARS.V7, VARS.V7_B,
VARS.V8, VARS.V8_B,
VARS.V9, VARS.V9_B,
VARS.V10, VARS.V10_B,

So here I want to read only the VARS.V1, VARS.V2, VARS.V3...VARS.V10. Then how can I display all of the readings in the list box?? Anyone here can help me or give some suggestion to solve my problem??

We would love to help you, but one rule here is that u show some effort at tackling your problem i.e show us some code and we will guide you or correct you where it's necessary

Hello guys, by the way I am a newbie here. This is my first post in this forum. I am now doing a window application(MFC.exe-dialog based) using the Microsoft Visual C++ 6 Enterprise Edition. Actually I am doing the simple application that read a string from text file. I only can read the whole text file using CStdio. But for now, I have stuck in reading the character in the text file line by line following the comma separated as the delimiter. This is the sample of the text file to be read:

VARS.V1, VARS.V1_B,
VARS.V2, VARS.V2_B,
VARS.V3, VARS.V3_B,
VARS.V4, VARS.V4_B,
VARS.V5, VARS.V5_B,
VARS.V6, VARS.V6_B,
VARS.V7, VARS.V7_B,
VARS.V8, VARS.V8_B,
VARS.V9, VARS.V9_B,
VARS.V10, VARS.V10_B,

This is the code CfilenameDlg.cpp:

void CTutor2Dlg::DisplayVariableButton()
{
   
CStdioFile Inputfile, Outputfile;
	CFileException FileExc;
	UINT nOpenFlags;
	CString s;
nOpenFlags = CFile::modeRead;
if (!Inputfile.Open("data.txt", nOpenFlags, &FileExc)) {
	FileExc.ReportError();
	return;
	}
nOpenFlags = CFile::modeWrite | CFile::modeCreate;
if (!Outputfile.Open("Output.txt", nOpenFlags, &FileExc)) {  
	FileExc.ReportError();
	return;
	}
while (Inputfile.ReadString(s))
	Outputfile.WriteString(s+'\n');
Inputfile.Close();
Outputfile.Close();
   // TODO: Add your control notification handler code here
	
}

Above code only can read the whole data in the text file (data.txt) and create another text file (output.txt) that display all of the readings. So my problem here, I want to read only the VARS.V1, VARS.V2, VARS.V3...VARS.V10. Then I display all of the readings in the list box?? Is it possible to display the data in the List Box using

m_myListBox.AddString()

Anyone here can help me or give some suggestion to solve my problem??

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.