Binary to Text Convertor


 
Thread Tools Search this Thread
Top Forums Programming Binary to Text Convertor
# 1  
Old 09-23-2004
Binary to Text Convertor

Hey Im starting out in C just recently and Im needing a string that converts binary to text, The only way i know of doing this without knowledge of C entirely. Is Making a sorta of library of the entire alphabet in binary for the program to select the text from it to display a sentence. If that makes any sense, anyways any help would be appreciated as would some tutorials on these matters.
# 2  
Old 09-24-2004
nope just a hobby i graduated from school later year.
# 3  
Old 09-24-2004
here is one way - using strtol()
Code:
#include <stdlib.h>
/* assume two hex chars per ascii value */
void hex2ascii(char *dest, char *src){
      char tmp[4]={0x0};     
      char **ptr=NULL, 
           *buf=dest;
      *buf=0x0;
      if(*src){
          for(int i=0;src[i];i+=2){
              strncpy(tmp,&src[i],2);
              sprintf(tmp,"%c",strtol(tmp,ptr,16) );
              *buf++=tmp[0];
          }
      }
      *buf=0x0;   
}

You can also use sscanf().
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Text File with Binary Values processing

Hello all, I have a txt file containing millions of lines. Below is the example: {tx:be} head -50 file.txt Instr1: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Instr1:... (6 Replies)
Discussion started by: Zam_1234
6 Replies

2. Shell Programming and Scripting

Convert binary to text Perl script

Hello everyone, I have a binary file with a structure unknown. I have found 2 perl scripts that it seems to do the convertion but I get sintactic errors when I run them, may somebody test these 2 scripts please and see if really work? One if from here... (10 Replies)
Discussion started by: Ophiuchus
10 Replies

3. AIX

Convert clear text into binary

Hi I need to display the binary text of an clearn text which is sent as input to the shell script (c shell); ex: I will pass "HELLO" as input, and i should get the binary format of the text Thanks in advance Mohan (1 Reply)
Discussion started by: mKarri
1 Replies

4. Shell Programming and Scripting

Binary to ASCII(TEXT converion)

Hi all, I have been trying to convert a binary file to TEXT/ASCII file in linux/solaries.and commands like string are no good.Also i am not sure how the how output of the file looks like... I am attaching the binary file as zip since i couldnt load it in its original form in the post incase... (1 Reply)
Discussion started by: pistachio
1 Replies

5. Programming

trying to convert binary data to text using C++

i hav tried to convert binary 2D data into text using binreader and writing into text file using streamwriter. i use ReadSingle() function to convert from binary to ascii, although it works good in 1D data but not in more dimensions. the kind of values i get are -1.265369923E+038 and like ... (2 Replies)
Discussion started by: geet
2 Replies

6. UNIX for Dummies Questions & Answers

How to convert binary Unix file to text

Hi all, I have a print control file (dflt) for Oracle which is in binary. As I am going to develope an application in Window environment, I would like to reference the dflt file. But it is in binary format and I cannot access it. Anyone can suggest me how to convert the file into text or... (5 Replies)
Discussion started by: user12345
5 Replies

7. UNIX for Dummies Questions & Answers

Binary data to text file conversion

Dear Sir; i want to know how the binary data convert to text file or readablw format (ASCII).If possible pl. help me for the software and where it is available for download. i.e. (1 Reply)
Discussion started by: auro123
1 Replies

8. Shell Programming and Scripting

is it text or binary

I need to know from a script if a given file is a text file (ascii) or binary. I need it in order to do dos2unix on each text file - and not on binary files (1 Reply)
Discussion started by: avnerht
1 Replies

9. Shell Programming and Scripting

Perl to C convertor

Is there one out there that supports Perl/Tk ??? (5 Replies)
Discussion started by: perleo
5 Replies

10. Programming

Binary to text format conversion

Hi, Please can any one tell me how to convert binary data to text format and vice versa. If possible give me the algorithm or C program. Thanks in advance Waiting for reply Bye:o (5 Replies)
Discussion started by: manjunath
5 Replies
Login or Register to Ask a Question