09-13-2005
strncpy(ver, buffer2 +5,2);
Hi,
Can someone help me understand this code?
strncpy(job, buffer2,5);
strncpy(ver, buffer2 +5,2);
Thanks for all the help!
9 More Discussions You Might Find Interesting
1. Cybersecurity
Hi everyone
I'm a HPUX system admin, and need some help. Our organisation is full of red tape and managers like that like to hold many meetings but take little action. I need to persuade my line manager that we should move our two nameservers onto BIND 8.
Can anyone please point me to some... (2 Replies)
Discussion started by: alwayslearningunix
2 Replies
2. AIX
I read that IBM came up with a new AIX version that would be fully integrated with Linux (I guess compared to older versions of AIX that could not) and I was hoping I bring this for discussion here so I learn more about IBM UNIX OS
Can anybody put few simple and practical comparisons between... (0 Replies)
Discussion started by: aliissa
0 Replies
3. UNIX for Advanced & Expert Users
How do i set up X25 protocol on version 5 of Tru Unix (Compaq). I have manged to do it using version 4. What are the major differences.:confused: (1 Reply)
Discussion started by: samudimu
1 Replies
4. Programming
haiu all
what makes strncpy to coredump (0 Replies)
Discussion started by: vijaysabari
0 Replies
5. UNIX for Dummies Questions & Answers
Can someone clue me in as to what version of HP-UX did USB support start? Specifically mass storage support. We have serveral HP Visualize systems and would like to connect up an external USB drive to do backups. (0 Replies)
Discussion started by: emcatc
0 Replies
6. Programming
Hi All,
Please clear the following doubt.
int main()
{
char str1;
char str2 = "HelloWorld";
int len = strlen(str2);
strncpy(str1, str2, len);
str1 = '\0';
printf("%s", str1);
}
In the above program i'm initializing the 10th byte of str1 to null.
what will happen to the memory of... (13 Replies)
Discussion started by: arunviswanath
13 Replies
7. Solaris
Hello all, I am having a little issue with BEA webloigc server Version 8.1, previously, we we confugred we where able to Grep processes for BEA and we could get the processes listed now I am only able to see the start weblogic script process. the weblogic server is up and running and performing its... (2 Replies)
Discussion started by: jvgvr6
2 Replies
8. UNIX for Dummies Questions & Answers
Hi,
Using Redhat version 6.0, I need nmap so I have downloaded. But it requires many other dependencies, when I try to install it. See below err.msg. Is there any other way to get this installed, or I need to download each of the dependencies.
rpm -Uhv nmap-5.51-2-mdv2011.0.x86_64.rpm... (3 Replies)
Discussion started by: samnyc
3 Replies
9. HP-UX
anyone has an idea from where can i download gcc 3.4.6 for hp-ux 11iv3 itanium? (0 Replies)
Discussion started by: guy3145
0 Replies
LEARN ABOUT REDHAT
strcpy
STRCPY(3) Linux Programmer's Manual STRCPY(3)
NAME
strcpy, strncpy - copy a string
SYNOPSIS
#include <string.h>
char *strcpy(char *dest, const char *src);
char *strncpy(char *dest, const char *src, size_t n);
DESCRIPTION
The strcpy() function copies the string pointed to by src (including the terminating ` ' character) to the array pointed to by dest. The
strings may not overlap, and the destination string dest must be large enough to receive the copy.
The strncpy() function is similar, except that not more than n bytes of src are copied. Thus, if there is no null byte among the first n
bytes of src, the result will not be null-terminated.
In the case where the length of src is less than that of n, the remainder of dest will be padded with nulls.
RETURN VALUE
The strcpy() and strncpy() functions return a pointer to the destination string dest.
BUGS
If the destination string of a strcpy() is not large enough (that is, if the programmer was stupid/lazy, and failed to check the size
before copying) then anything might happen. Overflowing fixed length strings is a favourite cracker technique.
CONFORMING TO
SVID 3, POSIX, BSD 4.3, ISO 9899
SEE ALSO
bcopy(3), memccpy(3), memcpy(3), memmove(3)
GNU
1993-04-11 STRCPY(3)