Thread: Reading a file
View Single Post
Old 04-27-2006, 03:57 AM   #1 (permalink)
coolman
Registered User
 
Join Date: Mar 2006
Posts: 25
coolman is on a distinguished road
Reading a file

I am trying to read in a file which will get rid of unwanted variables like ------ as you can see below
I was thinking of using split and strip but if i do surly i gota stores these lines as string then
I can manipulate the string and get rid of the -----------

ID |FIRSTNAME| SECONDNAME |Study |
------------------------------------------
12400 JOHN MAN IT
------------------------------------------
12500 NICE JOHN LAW
-------------------------------------------
12600 PATRICK MAN CS
------------------------------------------
so far my psuedo code is

Read in the file
Store each line to be a string array
get rid of the ------ (so get rid the lines that have -------)
while loop print line
until no more line


Which is poor

i dont know what function i can use to get rid of the ------ and display the data in a nice format like

ID FIRSTNAME SECONDNAME Study

12400 JOHN MAN IT
12500 NICE JOHN LAW
12600 PATRICK MAN CS

so what would be my next line in the psuedo code after Read in file, do u think I should store the data in a array then have a loop which will display the lines until EOF but after that what function do i use to remove the -----

Last edited by coolman; 04-27-2006 at 10:43 AM.
coolman is offline   Reply With Quote