Sponsored Content
Top Forums UNIX for Advanced & Expert Users Another binary manipulation thread. Post 302845061 by wisecracker on Tuesday 20th of August 2013 04:33:49 PM
Old 08-20-2013
Hi DGPickett...
Quote:
The bash shell can deal with binary output, sure, but binary input?
I assume you mean from keyboard input...
Code:
Last login: Tue Aug 20 21:18:52 on ttys000
AMIGA:barrywalker~> > /tmp/bin.dat
AMIGA:barrywalker~> read -p "INPUT:- " -e text ; echo -e -n "$text" > /tmp/bin.dat
INPUT:- \\\xFF\\\x00\\\xFF\\\x00
AMIGA:barrywalker~> hexdump -C /tmp/bin.dat
00000000  ff 00 ff 00                                       |....|
00000004
AMIGA:barrywalker~> _

 

4 More Discussions You Might Find Interesting

1. Programming

How to cancel a thread safely from the initial thread?

how about asynchronous canceling? or with signal? if with signal whether it effects the process? my english so badly :( :( (1 Reply)
Discussion started by: alan.zhao
1 Replies

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

3. Shell Programming and Scripting

Another Building Block, Binary File Manipulation...

Apologies for any typos, and IF this has been done before... This is yet another building block. The code generates a 256 byte binary file of _characters_ 0x00 to 0xFF for general usage and generates another binary file manipulated in a basic way. I need this facility for a kids project I am... (0 Replies)
Discussion started by: wisecracker
0 Replies

4. Forum Support Area for Unregistered Users & Account Problems

Not able to post thread/reply to thread

Dear Moderator I am not able to post any new thread or post reply to mine old thread. Kindly help as i am stuck on one problem and needed suggestion. Regards Jaydeep (1 Reply)
Discussion started by: jaydeep_sadaria
1 Replies
strncpy(9r)															       strncpy(9r)

NAME
strncpy - General: Copies a null-terminated character string with a specified limit SYNOPSIS
char * strncpy( char *s1, char *s2, int n ); ARGUMENTS
Specifies a pointer to a buffer of at least n bytes. Specifies a pointer to a string (an array of characters terminated by a null charac- ter). Specifies the number of characters to be copied. DESCRIPTION
The strncpy routine copies string s2 to buffer s1. The routine stops copying after it copies a null character or n characters, whichever comes first. If the length of s2 as determined by the null character is less than n, the routine pads s1 with null characters. RETURN VALUES
The strncpy routine returns a pointer to /NULL at the end of the first string (or to the location following the last copied character if there is no NULL). The copied string will not be null terminated if the length of s2 is n characters or more. SEE ALSO
Routines: bcopy(9r), blkclr(9r), copystr(9r), ovbcopy(9r), strcpy(9r) strncpy(9r)
All times are GMT -4. The time now is 10:07 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy