Solved

Save Hex data in a file

Posted on 2006-07-11
1
171 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

790 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