Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Save Hex data in a file

Posted on 2006-07-11
1
Medium Priority
?
177 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 400 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

926 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