🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.comp.lang.learn.c-c++
Article #407

Manipulating Input

#407
From: Mariana
Date: Sat, 10 Oct 1998 00:00
55 lines
1595 bytes
Hi,

I am trying to find a way of manipulating input from a txt file.
The following is a portion of the code,

void DisplayPointsTable()
{
char FileName[13];
char ch;
clrscr();
cout << "\nPlease type name of file to load... ";
cin >> FileName;
ifstream FileIn;
FileIn.open(FileName);

clrscr();
if(!FileIn)
{
	cerr << "\nThis file could not be found." << endl;
   exit(1);
}

cout << endl;

while (!FileIn.eof())
{
    FileIn.get(ch);
    cout << ch;
}
FileIn.close();
}

-----------------------------------

This reads in a txt file from disk and outputs the contents to the screen
fine, what I would like to do is read the input into an array for example 
and then output the data to screen in different positions.
For example.
The txt file on disk looks like this.

3  4  John
4  5  Bill
4  6  House

I would like to do this

John	3	4
Bill	4	5
House	4	6
 
As I said I can read the data in from a file and display it to screen in 
its original format, but for the life of me I can't work out how to do 
the above. Any thoughts would be appreciated.

Cheers
Technical Details
Message-ID: <MPG.1089a043d48ce4df989680@news.ozemail.com.au>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f8d38,77461b0e4c74496d,start
X-Google-Attributes: gidf8d38,public
X-Google-Thread: 114592,77461b0e4c74496d,start
X-Google-Attributes: gid114592,public
From: marianat@ozemail.com.au (Mariana)
Subject: Manipulating Input
Date: 1998/10/10
Message-ID: <MPG.1089a043d48ce4df989680@news.ozemail.com.au>
X-Deja-AN: 399610377
Organization: OzEmail Ltd.
Newsgroups: alt.comp.lang.learn.c-c++,borland.public.cpp.language