Solved

TFileStream

Posted on 2001-09-14
8
312 Views
Last Modified: 2010-04-06
Hello,

Can Anyone give me an example how to read from a file with TFileStream?

Greetings,

Wim
0
Comment
Question by:wimhhf
  • 3
  • 3
  • 2
8 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6482293
in which context?
0
 

Author Comment

by:wimhhf
ID: 6482317
I had a binary file:

I tried this:

var F: TFileStream
begin
  If OpenDialog1.Execute
  then Bestand.Create(OpenDialog1.FileName, fmOpenRead);
end;

the compiler gives a acces violation
0
 
LVL 17

Accepted Solution

by:
geobul earned 50 total points
ID: 6482332
Hi,

var F: TFileStream
begin
 If OpenDialog1.Execute then
   F := TFileStream.Create(OpenDialog1.FileName, fmOpenRead);
end;

Regards, Geo
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 27

Expert Comment

by:kretzschmar
ID: 6482348
as geo said,
fast geo :-(

;-)
0
 
LVL 17

Expert Comment

by:geobul
ID: 6482459
Hi Meikl, I've got a new ISP and my connection goes at lightning speed :-)
0
 

Author Comment

by:wimhhf
ID: 6487486
But how can I read data on a specific address? Example: Data on address 0x0030.......
0
 
LVL 17

Expert Comment

by:geobul
ID: 6489578
Hi,

var
  Buf: array[1..255] of char;
begin
  // initialize the buffer
  FillChar(Buf, SizeOf(Buf), Ord(' '));
  // move the current stream cursor to the desired position
  F.Seek(48, soFromBeginning);
  // read 255 bytes from the stream
  F.Read(Buf, SizeOf(Buf));
  // Buf contains the next 255 bytes starting from 0x0030 now
  ...
end;

Regards, Geo
0
 

Author Comment

by:wimhhf
ID: 6489635
Thanks!
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

827 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question