Solved

TFileStream

Posted on 2001-09-14
8
316 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

 
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Suggested Courses
Course of the Month5 days, 3 hours left to enroll

636 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