Sponsored Content
Full Discussion: Binary write POSIX-ly.
Top Forums UNIX for Advanced & Expert Users Binary write POSIX-ly. Post 302980495 by RudiC on Monday 29th of August 2016 07:59:54 AM
Old 08-29-2016
Do you have the xxd tool available? It provides a
Quote:
-r | -revert
reverse operation: convert (or patch) hexdump into binary.
So, if you have your input as hexadecimal - not octal - like
Code:
00
01
02
03
04
05
06
07
08
09
0A
0B
0C
0D
0E
0F
10
11
12
13
14
15
16
17
18
19
1A
1B
1C
1D
1E
1F

Code:
xxd -r -p file | hd
00000000  00 01 02 03 04 05 06 07  08 09 0a 0b 0c 0d 0e 0f  |................|
00000010  10 11 12 13 14 15 16 17  18 19 1a 1b 1c 1d 1e 1f  |................|
00000020

will convert it to a perfect binary file. And, pretty FAST!



EDIT: uudecode will also create binary files if fed with the data it understands.

Last edited by RudiC; 08-29-2016 at 09:13 AM..
 

10 More Discussions You Might Find Interesting

1. Programming

ANSI C vs POSIX

can somebody explain about the ANSI C vs POSIX. say i was using open and fopen, i know that open is POSIX, and fopen is ANSI C. i read that that POSIX is a system call and ANSI C is like a standard library function. wouldn't the fopen function has to call on open function anyway to open any kind... (2 Replies)
Discussion started by: bb00y
2 Replies

2. UNIX for Advanced & Expert Users

what can I get the posix standard?

I wanted study and write a unix like system. who can help me. ------------- Removed the garbled characters... not sure why they were there... (2 Replies)
Discussion started by: crashsky
2 Replies

3. Programming

Posix

HI, When i am configuring php in SUN Solaris. I am getting the below error. configure: error: Your system seems to lack POSIX threads. Do i need to install POSIX? If so can somebody let me know where can i download POSIX for Solaris 8? Thanks, (2 Replies)
Discussion started by: Krrishv
2 Replies

4. Programming

how to write a file to binary format in C ?

I'm in the Solaris environment. I want to write data to a file, but I don't want it to be easily read from the C shell. For example, here's my code: main () { FILE *fo; fo = fopen ("filename", "w"); fprintf (fo, "This is a test.\n"); fclose (fo); } Anyone can open up... (3 Replies)
Discussion started by: serendipity1276
3 Replies

5. IP Networking

read/write,write/write lock with smbclient fails

Hi, We have smb client running on two of the linux boxes and smb server on another linux system. During a backup operation which uses smb, read of a file was allowed while write to the same file was going on.Also simultaneous writes to the same file were allowed.Following are the settings in the... (1 Reply)
Discussion started by: swatidas11
1 Replies

6. UNIX for Advanced & Expert Users

System V or POSIX

Hi , I am using UNIX network programming Vol1 (by R Stevens) book to learn about IPC. I would be using HP-UX,Solaris and Linux at my work. I have sections for POSIX and for System V in that book. I am quite confused in indentifying those OSs as POSIX or SYstem V. Can anyone please... (1 Reply)
Discussion started by: kumaran_5555
1 Replies

7. Programming

POSIX Thread Help

I want to create a program that creates 2 child process, and each of them creates 2 threads, and each thread prints its thread id. I0ve allread done that the outuput isn't the outuput i want. When a run the following comand "$./a.out | sort -u | wc -l" I have the folowing output 2 $: It should... (3 Replies)
Discussion started by: pharaoh
3 Replies

8. Shell Programming and Scripting

Convert binary file to csv and then back to the binary format

Hello *nix specialists, Im working for a non profit organisation in Germany to transport DSL over WLAN to people in areas without no DSL. We are using Linksys WRT 54 router with DD-WRT firmware There are at the moment over 180 router running but we have to change some settings next time. So my... (7 Replies)
Discussion started by: digidax
7 Replies

9. Shell Programming and Scripting

Is it possible to write write multiple cronjobs in shellscript??

Hi All, I need the answer of below question? 1) How to write multiple cronjobs in shellscript? Is there any way or we cant write in shellscript... Regards, Priyanka (2 Replies)
Discussion started by: pspriyanka
2 Replies

10. UNIX for Advanced & Expert Users

Change value for POSIX

Hi, I have a VM with following configration . 3.10.0-693.1.1.el7.x86_64 #1 SMP Thu Aug 3 08:15:31 EDT 2017 x86_64 x86_64 x86_64 GNU/Linux My current POSIX is :-- Your environment variables take up 2011 bytes POSIX upper limit on argument length (this system): 2093093 POSIX smallest... (15 Replies)
Discussion started by: Abhayman
15 Replies
LIMITS(3)						   BSD Library Functions Manual 						 LIMITS(3)

NAME
limits -- standard limits SYNOPSIS
#include <limits.h> DESCRIPTION
The <limits.h> header defines various compile-time and runtime limits. These can be grouped into three categories: 1. Compile-time limits defined in a header file. 2. Runtime system limits that are not associated with a file or directory; see sysconf(3). 3. Runtime limits that are associated with a file or directory; see pathconf(2). The <limits.h> header has been standardized by at least three entities. ISO Limits The limits defined by the ISO/IEC 9899:1999 (``ISO C99'') standard are all compile-time limits. The numerical (integer) limits are: Constant Type Minimum value CHAR_BIT char 8 SCHAR_MAX signed char 127 SCHAR_MIN signed char -127 UCHAR_MAX unsigned char 255 INT_MAX int 32767 INT_MIN int -32767 UINT_MAX unsigned int 65535 SHRT_MIN short -32767 SHRT_MAX short 32767 USHRT_MAX unsigned short 65535 LONG_MAX long int 2147483647 LONG_MIN long int -2147483647 ULONG_MAX unsigned long int 4294967295 LLONG_MAX long long int 9223372036854775807 LLONG_MIN long long int -9223372036854775807 ULLONG_MAX unsigned long long int 18446744073709551615 MB_LEN_MAX - 1 All listed limits may vary across machines and operating systems. The standard guarantees only that the implementation-defined values are equal or greater in absolute value to those shown. The values permit a system with 16-bit integers using one's complement arithmetic. Depending whether the system defines char as signed or unsigned, the maximum and minimum values are: Constant Type Minimum value CHAR_MAX char either SCHAR_MAX or UCHAR_MAX CHAR_MIN char either SCHAR_MIN or 0 The two special cases, CHAR_BIT and MB_LEN_MAX, define the number of bits in char and the maximum number of bytes in a multibyte character constant, respectively. POSIX Limits The POSIX.1 standard specifies numerous limits related to the operating system. For each limit, a separate constant prefixed with ``_POSIX_'' defines the lowest value that the limit is allowed to have on any POSIX compliant system. For instance, _POSIX_OPEN_MAX defines the minimum upper bound permitted by POSIX for the number of files that a single process may have open at any time. This ensures that a por- table program can safely reach these limits without prior knowledge about the actual limits used in a particular system. As the limits are not necessary invariant, pathconf(2) and sysconf(3) should be used to determine the actual value of a limit at runtime. The manual pages of these two functions also contain a more detailed description of the limits available in NetBSD. XSI Limits Also the X/Open System Interface Extension (XSI) specifies few limits. In NetBSD these are limited to LONG_BIT (the number of bits in long), WORD_BIT (the number of bits in a ``word''), and few limits related to float and double. SEE ALSO
getconf(1), pathconf(2), sysconf(3), types(3), unistd(3) Richard W. Stevens and Stephen A. Rago, Advanced Programming in the UNIX Environment, Addison-Wesley, Second Edition, 2005. BSD
August 9, 2011 BSD
All times are GMT -4. The time now is 11:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy