Solved

TFileStream

Posted on 2001-09-14
8
308 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
Comment Utility
in which context?
0
 

Author Comment

by:wimhhf
Comment Utility
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
Comment Utility
Hi,

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

Regards, Geo
0
 
LVL 27

Expert Comment

by:kretzschmar
Comment Utility
as geo said,
fast geo :-(

;-)
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 17

Expert Comment

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

Author Comment

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

Expert Comment

by:geobul
Comment Utility
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
Comment Utility
Thanks!
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This video discusses moving either the default database or any database to a new volume.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

771 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now