Solved

Save Hex data in a file

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

Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
PHP preg_replace code convert to Delphi 14 98
Wincontrol not (correctly) drawn 15 59
TlistView is Really heavy on Android 3 44
TAction.OnAfterExecute? 2 32
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…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

739 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