I know how to open and read/write using fstream objects, but what I want to do is use a windows forms app and a listbox - I want to read a text file into a listbox, but can't seem to make it work (at least not with fstream) can someone point me in the right direction please?
// reading small (12 items) textfile into an array
cpp
#include <iostream>
#include <fstream>
using namespace std;
int main()
{
char buffer[2];
char person[12][20];
short j, loop, flag;
const int MAX = 12;
ifstream inPeople;
ofstream outFile;
// display
cout << "===========" << endl << " Available" << endl ;
cout << "===========" << endl;
// get the names into array
// first open file for input
inPeople.open("DSED.txt");
j = 0;
while ( ! inPeople.eof() )
{
inPeople.getline(person[j],20);
j++;
}
// close this file
inFile.close();
cin.getline(buffer,2);
return 0;
}
Mod edit: Please
Thanks, gabehabe