Sponsored Content
Full Discussion: binary to ascii
Top Forums Shell Programming and Scripting binary to ascii Post 302246595 by Annihilannic on Tuesday 14th of October 2008 03:02:37 AM
Old 10-14-2008
It's not guaranteed... it depends what kind of data it contains. If it contains ASCII strings interspersed with unprintable characters then strings will do the job. If it's encrypted or in a different encoding (EBCDIC) then more work will be required... the question is too open ended without more information, i.e. what type of main frame, what type of file it is, etc.
 

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. UNIX for Advanced & Expert Users

Converting ASCII to Binary mode

Dear All, Business Users are transfering ( FTP ) a CSV file into the IBM AIX box with transfer mode as ASCII. But I want to convert the CSV file from ASCII mode into binary mode, as my script expects file in binary mode. Is it possible to do through Unix commands? Thanks in Advance, RK (1 Reply)
Discussion started by: srajeshmca
1 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 or ascii file

I want to verify the file is Binary or ascii file and accordingly I want to switch the program with ret code ie 0 or success and 1 for failure Can any one help me is this a correct syntex...i am getting error #!/bin/ksh $file filename if echo "ascii fie Found" else echo " binary... (6 Replies)
Discussion started by: u263066
6 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(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

7. 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

8. Shell Programming and Scripting

Difference between ascii and binary file -

what is the diff between ascii and binary file. my understand is that.. ascii file - has only line feed - \n in it where as binary file - has both line feed and carriage return in it- \r\n is that correct. also,what is the ksh command to identify whether it is a binary or ascii... (1 Reply)
Discussion started by: billpeter3010
1 Replies

9. Solaris

Convert files from binary to ASCII

I have a huge files in binary format thanks to help me in finding a way to convert these files from Binary format to ASCII format. (0 Replies)
Discussion started by: PRINCESS_RORO
0 Replies

10. 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
ADDR2ASCII(3)						   BSD Library Functions Manual 					     ADDR2ASCII(3)

NAME
addr2ascii, ascii2addr -- Generic address formatting routines LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <arpa/inet.h> char * addr2ascii(int af, const void *addrp, int len, char *buf); int ascii2addr(int af, const char *ascii, void *result); DESCRIPTION
The routines addr2ascii() and ascii2addr() are used to convert network addresses between binary form and a printable form appropriate to the address family. Both functions take an af argument, specifying the address family to be used in the conversion process. (Currently, only the AF_INET and AF_LINK address families are supported.) The addr2ascii() function is used to convert binary, network-format addresses into printable form. In addition to af, there are three other arguments. The addrp argument is a pointer to the network address to be converted. The len argument is the length of the address. The buf argument is an optional pointer to a caller-allocated buffer to hold the result; if a null pointer is passed, addr2ascii() uses a statically- allocated buffer. The ascii2addr() function performs the inverse operation to addr2ascii(). In addition to af, it takes two arguments, ascii and result. The ascii argument is a pointer to the string which is to be converted into binary. The result argument is a pointer to an appropriate network address structure for the specified family. The following gives the appropriate structure to use for binary addresses in the specified family: AF_INET struct in_addr (in <arpa/inet.h>) AF_LINK struct sockaddr_dl (in <net/if_dl.h>) AF_INET and AF_LINK constants are defined in <sys/socket.h> RETURN VALUES
The addr2ascii() function returns the address of the buffer it was passed, or a static buffer if the a null pointer was passed; on failure, it returns a null pointer. The ascii2addr() function returns the length of the binary address in bytes, or -1 on failure. EXAMPLES
The inet(3) functions inet_ntoa() and inet_aton() could be implemented thusly: #include <sys/socket.h> #include <arpa/inet.h> char * inet_ntoa(struct in_addr addr) { return addr2ascii(AF_INET, &addr, sizeof addr, 0); } int inet_aton(const char *ascii, struct in_addr *addr) { return (ascii2addr(AF_INET, ascii, addr) == sizeof(*addr)); } In actuality, this cannot be done because addr2ascii() and ascii2addr() are implemented in terms of the inet(3) functions, rather than the other way around. ERRORS
When a failure is returned, errno is set to one of the following values: [ENAMETOOLONG] The addr2ascii() routine was passed a len argument which was inappropriate for the address family given by af. [EPROTONOSUPPORT] Either routine was passed an af argument other than AF_INET or AF_LINK. [EINVAL] The string passed to ascii2addr() was improperly formatted for address family af. SEE ALSO
inet(3), linkaddr(3), inet(4) HISTORY
An interface close to this one was originally suggested by Craig Partridge. This particular interface originally appeared in the INRIA IPv6 implementation. AUTHORS
Code and documentation by Garrett A. Wollman, MIT Laboratory for Computer Science. BUGS
The original implementations supported IPv6. This support should eventually be resurrected. The NRL implementation also included support for the AF_ISO and AF_NS address families. The genericity of this interface is somewhat questionable. A truly generic interface would provide a means for determining the length of the buffer to be used so that it could be dynamically allocated, and would always require a ``struct sockaddr'' to hold the binary address. Unfortunately, this is incompatible with existing practice. This limitation means that a routine for printing network addresses from arbi- trary address families must still have internal knowledge of the maximum buffer length needed and the appropriate part of the address to use as the binary address. BSD
June 13, 1996 BSD
All times are GMT -4. The time now is 01:02 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy