#include <iostream.h>
#include <fstream.h>
void main()
{
ifstream in;
ofstream out;
char ch;
char zipcode[6]; //NOTE, that length of zipcode must be equivalent vith length from file
char cityname[255]; //try 255, if length of cityname not more, than 255
in.open("postcody.txt");
while (!in.eof()) {
in.get(zipcode,6);
in.get(cityname,255);
cout<<"zip:"<<zipcode<<";c
}
in.close();
cout << endl << "done" << endl;
}
Main Topics
Browse All Topics





by: Marty21Posted on 2003-03-12 at 03:30:04ID: 8118599
Actually I forgot to mention that the reason I wrote this is also because when I run this program as is above, executing it let's the console crash for some reason...
I'll convert the zipcode-string later on in an int. Is this a preferred way to do it?