Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

TFileStream

Posted on 2001-09-14
8
Medium Priority
?
320 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 150 total points
ID: 6482332
Hi,

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

Regards, Geo
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
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

Technology Partners: 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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

721 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