Solved

Save Hex data in a file

Posted on 2006-07-11
1
172 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: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone 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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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 a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

679 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