Solved

TFileStream

Posted on 2001-09-14
8
309 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
 
LVL 27

Expert Comment

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

;-)
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

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…
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…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.

937 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

9 Experts available now in Live!

Get 1:1 Help Now