Presumably you have a buffer filled with data and you know the length. Given those two bits of information, you simply set the "length" byte to space and increment length. For example:
Code:
#include <stdio.h>
int main ( void )
{
char Buffer [1024] = "ABC\0DEF\n";
int Length = 8;
Buffer [Length++] = ' ';
fwrite (Buffer, 1, Length, stdout);
/* or
write (1, Buffer, Length);
*/
}
For the same reason you can not use strcat, you can not use the standard printf(3C) functions with a "%s" tag. It would stop at the NUL byte '\0' which is at the 4th byte (or offset 3).
I need to know how to record the hostname, date/time and all of the process and send it all to one file. I know that the commands I need are hostname, date and ps but I don't know how to do them all and send them all to the same file. Please help! (1 Reply)
Friends,
I've tried on solaris, but I could n't get ascii data
dd if=binaryinputfile bs=1 skip=3800 count=4 | od -t u4
output :
INDBU3:/usr/users/FTAMUSER/kk $
dd if=SMP20041006173649188151 bs=1 skip=3800 count=4 | od -t u4
4+0 records in
4+0 records out
0000000 0000000000
0000004... (4 Replies)
Hi,
Am trying to write a shell script which will append a header and a footer to an existing file. Header will contain details like the current date while the footer will contain the no: of records listed in the file.
I know we can use the CAT command, but i have no clue abt the syntax to... (4 Replies)
Hi
I need to write a script where there the user enters 3 input parameter
variable
number
the program should ask the user left or right
if it is left , the number specified that many spaces should be added to the value in front of the value and saved in the samee variable itself and if it is... (5 Replies)
Hi.
I wrote a very simple script and it doesn't work :(
It is supposed to go to a certain directory, execute some command and append the output to the file "expo.dat"
what it does is that it writes to the file only one entery. I dont know if Im using the write synthax for "append". Here is... (3 Replies)
Hi,
I would like to know if it's possible to append data into a variable, rather than into a file. Although I can write information into a temporary file in /tmp, I'd rather if possible write into a variable, as I don't like the idea that should my script fail, I'll be polluting the server with... (5 Replies)
I am calling SQL script in my UNIX Shell script and trying to create the CSV file and my last column value of each row is 23 blank spaces.
In my SQL script,the last column is like below.
RPAD(' ',23,' ') -- Padding 23 blank Spaces
The CSV file is generated but the sapce(23 spaces) is... (2 Replies)
I have on file abc.txt
abc.txt:
20090807
Now I want to delete empty lines which has tap/whit spaces from abc.txt .and store the date value in the file into variable.some processs will update the this file with some date . if the process updtes thiis file with empty string , write the... (3 Replies)
Version Info
$ cat /etc/redhat-release
Red Hat Enterprise Linux Server release 5.4 (Tikanga)
$
$ echo $0
-ksh
I was trying to append date to the file name. The following syntax has worked
$ touch HELLO-`date '+%d-%b-%Y'`.txt
$ ls -alrt HELL*
-rw-r--r-- 1 rlapp oinstall 0 Feb 20... (2 Replies)
Hi
I have a file called text.txt contains
x
y
z
when i run a command i will get output like below
x 20
z 30
i want to insert x, z value in text.txt file and should be like this
x 20
y 0
z 30
can anyone help me please? (1 Reply)
Discussion started by: siva kumar
1 Replies
LEARN ABOUT OSF1
bcopy
bcopy(9r)bcopy(9r)NAME
bcopy - General: Copies a series of bytes with a specified limit
SYNOPSIS
void bcopy(
char *b1,
char *b2,
int n );
ARGUMENTS
Specifies a pointer to a byte string (array of characters). This pointer can reside in kernel address space or in user address space.
Specifies a pointer to a buffer of at least n bytes. This pointer can reside in kernel address space or in user address space. Specifies
the number of bytes to be copied.
DESCRIPTION
The bcopy routine copies n bytes from string b1 to buffer b2. No check is made for null bytes. The copy is nondestructive, that is, the
address ranges of b1 and b2 can overlap.
RETURN VALUES
None
EXAMPLES
The following code fragment shows a call to bcopy:
. . .
struct tc_slot tc_slot[TC_IOSLOTS];
. . .
char *cp;
. . .
bcopy(tc_slot[index].modulename, cp, TC_ROMNAMLEN + 1);
. . .
SEE ALSO
Routines: blkclr(9r), copystr(9r), ovbcopy(9r), strcpy(9r), strncpy(9r)bcopy(9r)