reading a text file into a string
From: zork (zork_at_nospam.com)
Date: 07/15/04
- Next message: Marius Amado Alves: "Re: reading a text file into a string"
- Previous message: zork: "Re: questions from a newbie"
- Next in thread: Marius Amado Alves: "Re: reading a text file into a string"
- Reply: Marius Amado Alves: "Re: reading a text file into a string"
- Reply: Marius Amado Alves: "Re: reading a text file into a string"
- Reply: Nick Roberts: "Re: reading a text file into a string"
- Reply: Jeffrey Carter: "Re: reading a text file into a string"
- Maybe reply: Jeffrey Carter: "Re: reading a text file into a string"
- Maybe reply: Randy Brukardt: "Re: reading a text file into a string"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 16 Jul 2004 03:27:57 +1000
hi, i would like to read a whole text file into a string. I thought of using
an unbounded_string for this:
----------
c, char: character;
text : unbounded_string;
...
-- read in text file
while not end_of_file ( File ) loop
Get ( File, c );
append ( text, c );
end loop;
...
put ( to_string ( text ) ); -- display content of unbounded_string
-- process text
for i in 1 .. length ( text ) loop
char := element ( text, i );
...
end loop;
-----------
... is this the general way of going about it? or is there a more prefered
method of reading in a whole text file (into whatever format) for
processing?
Thanks again!
cheers,
zork
- Next message: Marius Amado Alves: "Re: reading a text file into a string"
- Previous message: zork: "Re: questions from a newbie"
- Next in thread: Marius Amado Alves: "Re: reading a text file into a string"
- Reply: Marius Amado Alves: "Re: reading a text file into a string"
- Reply: Marius Amado Alves: "Re: reading a text file into a string"
- Reply: Nick Roberts: "Re: reading a text file into a string"
- Reply: Jeffrey Carter: "Re: reading a text file into a string"
- Maybe reply: Jeffrey Carter: "Re: reading a text file into a string"
- Maybe reply: Randy Brukardt: "Re: reading a text file into a string"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|