LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Convert ascii file to binary file in cvi

Is there a CVI function or a simple method to convert an ascii file to a binary file format?  Here is some simple data C4 7E.  I need to convert it to - ~.  Any suggestions?

0 Kudos
Message 1 of 3
(3,036 Views)

I expect that you have to elaborate. I do not expect that you missed the obvious: use fopen as if it is a binary file. You have to use fread and fwrite (instead of fgets and fputs). But I expect that you have some different purpose. And then you have to specify more detailed what you want.

 

0 Kudos
Message 2 of 3
(3,031 Views)

One possibility is to open the ASCII file to read with fopen ("asciifilename", "r"); and to open the binary file for writing using fopen ("binaryfilename", "wb"); Also have a look at the functions fread (), fwrite, and fclose() in the ANSI C library.The idea would be to read the data as text file, and then write the data in binary format. You do not need to convert anything on your own.

 

You may also want to have a look here

 

If your prefer, you can also use the functions ScanFile / FmtFile from the Formatting and I/O Library...

0 Kudos
Message 3 of 3
(3,025 Views)