try this:
Code:
#include <iostream.h>
#include <stdlib.h>
#include <string.h>
#include <fstream.h>
#include <conio.h>
#include <time.h>
int main(void)
{
int rnd = 0;
// need a buffer to store the data, since you
// are using int, you don't need a buffer any bigger than
// 12 chars
char input[12];
ofstream numbers("numList.lst");
if(numbers.is_open())
{
for(int x = 0; x < 9; x++)
{
rnd = rand() % 9;
cout << "Inputting " << rnd << "\n";
numbers << rnd << "\n" ;
}
numbers.close();
}
cout << "\n\n";
ifstream fin("numList.lst");
while(!fin.eof())
{
fin.getline(input, sizeof(input));
if(strlen(input) > 0)
{
// output as string, then as a number
cout << input << ", " << atoi(input) << "\n";
}
}
fin.close();
return(0);
}