Advertisement

07.05.2008 at 05:42PM PDT, ID: 23541159
[x]
Attachment Details

Urgent:strncpy

Asked by zizi21 in C Programming Language

hi,

could anyone pls help...

for strcpy - the definition says that it copies the nul character as well

but how about strncpy..

i.e.

char *s="hello world";

strncpy(tmp,s,5);

would hello be copied or would hell be copied and nul is inserted at the end...

i ask this because , i get memory problems..i think because of this...
tmp is dynamically allocated. thansk


Start Free Trial
[+][-]07.05.2008 at 05:52PM PDT, ID: 21938927

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: C Programming Language
Sign Up Now!
Solution Provided By: jaime_olivares
Participating Experts: 1
Solution Grade: A
 
 
[+][-]07.05.2008 at 06:20PM PDT, ID: 21938988

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628