🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Connecting TFileStream and TReader!

#334
From: Jon
Date: Fri, 17 Mar 2000 00:00
62 lines
2468 bytes
Hi people!

I am writing program that will read raw stats from my disc and then convert
them into decent looking statistic(html format)
Now i made many c++ Builder applications but this is first time i work with
files(read,write).

The problem is I cant "connect"  TFileStream and TReader classes.

I want to do this: Read text file and then use TReaders methods like
ReadChar,ReadFloat.ReadString etc ON THIS file.

Problem:

With TFileStream you can associate(read) file to pointer like this :
 TFileStream *filetoberead = new TFile
Stream(OpenDialog1->FileName,fmOpenRead);

"OpenDialog1->FileName" just opens open dialog so we can select
filename.Same is :

 TFileStream *filetoberead = new TFileStream("data.txt",fmOpenRead);

Now with filetoberead i CANT access any TReaders easy methods but
TFileStream has no methods to read characters(OK,has read but i want "easy"
ones like in TReader, like ReadString etc)

If i create TReader object :

TReader *file;

then I don't know(i cant) tell TReader to which file "*file" pointer should
point.

Every time i try to connect them i get something like:

[C++Error] unit1.cpp(27): Cannot convert 'Classes::TFileStream *' to
'Classes::TReader *'.

Is there any property in TReader in which i can set filename to be read?

In JAVA you do this:

   inStream = new FileInputStream("test.txt");
   StreamTokenizer file = new StreamTokenizer(inStream);

StreamTokenizer is similar to TReader and you can use StreamTokenizer method
on inStream file!

Any help is appreciated

--
Best regards,
Jon Welch
=============================================
BestRates, Inc.
http://bestrates.itgo.com
mailto:info@bestrates.itgo.com
---------------------------------------------
Independent Telecom Advisors  & Customer Support
Local, Long Distance, Data & Internet,
=============================================
Technical Details
Message-ID: <8ash95$gaq$1@planja.arnes.si>
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,a456f21deae1fc85,start
X-Google-Attributes: gidf8d38,public
X-Google-Thread: 114592,a456f21deae1fc85,start
X-Google-Attributes: gid114592,public
From: "Jon" <spam@spam.kill>
Subject: Connecting TFileStream and TReader!
Date: 2000/03/17
Message-ID: <8ash95$gaq$1@planja.arnes.si>
X-Deja-AN: 598633958
X-Priority: 3
X-MIMEOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
Organization: ARNES
X-MSMail-Priority: Normal
Newsgroups: alt.comp.lang.learn.c-c++,borland.public.cpp.language