Hello I Am Making An MFC Application. I have several combo boxes. I am reading from a file to put text
inside of them. I am needing to know how to seperate what goes in each box?
Inside my text file I have:
400w atx case //needs to go in one combo box
350w atx case
Asus Motherboard //needs to go into another combo box
ECS Motherboard
Here Is The Code I Use:
///////////Code starts here/////////////
char x; //make big enough to cover file
CString buffer;
ifstream file;
//Open file
file.open("database.txt", ios::in); //What ever your file is
//Check for file exist
//Check for file exist
if(!file)
{
CString facts = "File not found";
MessageBox(facts,NULL,MB_OK);
}
//Read data
while(!file.eof())
{
char x;
file.get(x);
if(x=='\n')
{
m_drCases.AddString(buffer);
m_drMother.AddString(buffer);
//MessageBox(buffer,NULL,MB_OK); //Test buffer
buffer="";
}
else
buffer = buffer + x;
}