Solved

Save Hex data in a file

Posted on 2006-07-11
1
169 Views
Last Modified: 2010-04-05
dear experts

i have an application that communicates with a microcontroller and takes hex data by serial port. i wanna save the data to a file on the hard disk. i prefer for example saving ascii code in a *.dat file. i've used chr() to do this but there are some problem
      memo1.Lines.Text:= memo1.Lines.Text+chr(00); // 00 is null
      memo1.Lines.Text:= memo1.Lines.Text+chr(10); //when i save chr(10) it also saves chr(13) and vice versa
      memo1.Lines.Text:= memo1.Lines.Text+chr(13);
i don't want to save the data in a text file.
have u any idea?

regards
0
Comment
Question by:shaasousaa
1 Comment
 
LVL 10

Accepted Solution

by:
atul_parmar earned 100 total points
ID: 17079848
Hi use TFileStream.  e.g.

var
  fs : TFileStream;
  ch : array [0..3] of char;
begin
  fs := TFileStream.Create('c:\test.dat', fmCreate);
  ch[0] := #0; ch[1] := #10; ch[2] := #13;
  fs.Write(ch, 3);
  fs.Free;
end;
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

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…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

747 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

12 Experts available now in Live!

Get 1:1 Help Now