Sponsored Content
Top Forums UNIX for Advanced & Expert Users Conversion from ASCII to binary for physical simulation code in C/C++ Post 302507413 by Cybertib on Wednesday 23rd of March 2011 07:17:25 PM
Old 03-23-2011
Ok then, that was a dummy question, and not an expert one...
Thank you for everything!

---------- Post updated at 12:17 AM ---------- Previous update was at 12:14 AM ----------

Quote:
Originally Posted by Corona688
No, they're completely different... The variables in a C program start as binary, and one of sprintf's jobs is to convert binary into ASCII. You're converting binary numbers into an ASCII string then writing the ASCII string to file.

My example doesn't convert -- it writes the variable direct, as binary. You could read them in as ASCII with with fgets and sscanf, then just write them back out raw as binary.
What about converting the old files into binary ?

"od" command seems good, but after several tests, conversion don't compress the data as expected. You gzip idea is interesting to not reach quotas, but the data need to be extracted before being treated with gnuplot in an ascii form. Using binary might much more fast, following the gnuplot documentation.

Idea?

Thank you again Smilie

Thibault
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Convert ASCII to BINARY

Here is what I did . . . . I FTP'd several *.pdf files from a web site to a UNIX server, and did not set the transfer mode to BIN, now Adobe thinks that the documents are corrupted. Is there a way to convert the *.pdf files to Binary so that Adobe can open them again. I would just re-download... (2 Replies)
Discussion started by: pc9456
2 Replies

2. Shell Programming and Scripting

ascii conversion

after converting my ebcidic file to ascii i get the following output 2097152+0 records in 1797345+1 records out Why is there a difference in number of records. Is the converson chopping off any records. All i am doing is just a conversion using the following script dd if=xaa cbs=152 ... (0 Replies)
Discussion started by: rintingtong
0 Replies

3. SCO

ascii to binary conversion in sco 5.0.5

Here is what I did . . . . I FTP'd several *.dbf zipped files from a SCO 5.0.5 server to winXP machine, and did not set the transfer mode to BIN, now when i was uncompressing these files in SCO 5.0.5 , it was giving "Bad Decode Table error. Is there a way to convert the *.dbf.Z files to Binary so... (1 Reply)
Discussion started by: sameek1211
1 Replies

4. Shell Programming and Scripting

binary to ascii

Hi, Is there a way to convert the binary file to ascii . the binary file is pipe delimited. from source the file(pipe delimited) is ftped to mainframe and from mainframe it is ftped to the unix box using binary format. Is there a way to change it back to ascii and view it? Thanks! (3 Replies)
Discussion started by: dnat
3 Replies

5. UNIX for Dummies Questions & Answers

Ascii or Binary?

Hello all, I am working with ftp servers in unix, and always I have to get and put files but I don't know exactly if I have to get or put them as an ascii or binary. Some files that I use are: .txt, .sav, .fmb, .pct, .sh, .ksh, .dat, .log. Somebody can tell me what is the difference between... (2 Replies)
Discussion started by: Geller
2 Replies

6. Shell Programming and Scripting

binary to ascii conversion

Hi, I have got a library file, created by compiling C code. The file information with "file" command, gives it a "application/x-archive" type file. I want to extract the release string of my software from this file, so that i can know which version of C files were used to create the lib. Can... (3 Replies)
Discussion started by: atulmt
3 Replies

7. Solaris

EBCDIC to ASCII Binary conversion issue on Solaris i-series Unix

Hi All, I am facing EBCDIC to ASCII Binary conversion on Solaris i-series Unix system. However this is working fine on Solaris Sparc Unix system. Input file having EBCDIC format does not work on Solaris i-series Unix system. Could you please tell me, what will be the root cause for same? (14 Replies)
Discussion started by: amodkavi
14 Replies

8. Shell Programming and Scripting

Bash - binary data to ascii code

Hello, With bash-script (ubunto server) I'm trying to read a binary file and, for each character, give back its ascii code (including extended ascii). For example: HEX => ASCII => PRINT f5 => 245 => õ 50 => 80 => P To load the binary file into a variable I tried in this way: ... (2 Replies)
Discussion started by: math4
2 Replies

9. Solaris

ASN Binary to ASCII

Dears, I need help to convert the binary file into ASCII format. Actually we have CDRs which is generated by telecom switch at this is in ASN1 format or binary format, I need to convert those binary formatted file into ASCII format using Perl, or shell scripting. Is there any way to solve... (3 Replies)
Discussion started by: PRINCESS_RORO
3 Replies

10. Shell Programming and Scripting

File conversion from Binary to ASCII though UNIX command

Hi All , I have a mainframe file which contains the data in EBCDIC format.I have downloaded this file from mainframe to windows in binary format(unreadable raw data).Now I want convert this file to ASCII format(readable format data) through Unix command.I have tried iconv but that is not working... (2 Replies)
Discussion started by: STCET22
2 Replies
xgas(1X)																  xgas(1X)

NAME
xgas - animated simulation of an ideal gas SYNOPSIS
xgas [-option...] OPTIONS
This is a toolkit program; all the usual toolkit options are available. Sets the autoStart resource. Sets the timeStepSize resource. Sets the delay resource. Sets the randomBounce resource. Sets the equilibrium resource. Sets the maxMolecules resource. Sets the fore- ground. Sets the background. DESCRIPTION
xgas is a physical simulation of an ideal gas in a heated box. Gas molecules move around the box with velocities dependent on their temper- ature. A chamber consisting of two boxes contains the gas molecules; the temperature of each box can be independently controlled by a scrollbar. When gas molecules collide with the walls, their temperature approaches that of the box. Use mouse button 1 to create molecules one at a time at the cursor position. Use mouse button 2 to create the maximum number of molecules at the cursor position. RESOURCES
The xgas program uses the following X resources: Starts the simulation automatically. Good for canned demos. Specifies the simulated time duration in microseconds for each cycle of computation. Specifies the real time interval between timestep computations. In each wall col- lision, a molecule bounces elastically (angle of incidence = angle of reflection). A component of randomness is added to this angle. Ran- domBounce varies from 0.0 (no randomness) to 1.0 (completely random angle of incidence). During each wall collision, a molecule's kinetic energy approaches that corresponding to the temperature of the wall. If equilibrium is 1.0, the molecule reaches the wall temperature imme- diately. For values between 1.0 and 0.0, the molecule approaches the temperature of the wall more slowly. Specifies the maximum number of molecules in the simulation. BUGS
When the chamber is resized, molecules should be rearranged appropriately. Instead, the molecule arrays are reinitialized. SEE ALSO
X(1X), xwd(1X) AUTHOR
Larry Medwin xgas(1X)
All times are GMT -4. The time now is 07:57 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy