strccpy

  • Follow


Hi,

I understand from the solaris man page that strccpy compress the c
escape sequence from the source and copy the string to target.
I wrote the following program to realize the same. But the output
seams to be same. Please let me know in what way can I realize the
output:

$> gcc temp.c -o temp -lgen

int main ()
{
        const char *s1="Hello\nWorld";
        char *s2 = (char *)malloc (30);
        printf ("s1[%d] : %s\n", strlen(s1), s1);
        s2 = strccpy (s2, s1);

        printf ("s2[%d] : %s\n", strlen(s2), s2);
}

--
Dust
0
Reply clcfans (4) 6/3/2010 4:42:06 AM

In article <16621031-3fd9-417f-bfe3-f598b691141f@j12g2000pri.googlegroups.com>,
	proxy foxy <clcfans@gmail.com> writes:
> Hi,
> 
> I understand from the solaris man page that strccpy compress the c
> escape sequence from the source and copy the string to target.
> I wrote the following program to realize the same. But the output
> seams to be same. Please let me know in what way can I realize the
> output:
> 
> $> gcc temp.c -o temp -lgen
> 
> int main ()
> {
>         const char *s1="Hello\nWorld";
>         char *s2 = (char *)malloc (30);
>         printf ("s1[%d] : %s\n", strlen(s1), s1);
>         s2 = strccpy (s2, s1);
> 
>         printf ("s2[%d] : %s\n", strlen(s2), s2);
> }

The C-language escape sequences have already been interpreted (compressed)
by the compiler. You will need to double-up the backslash to get the string
defined with the two characters '\' and 'n' in it.

const char *s1="Hello\\nWorld";

-- 
Andrew Gabriel
[email address is not usable -- followup in the newsgroup]
0
Reply andrew 6/3/2010 8:32:22 AM


1 Replies
223 Views

(page loaded in 0.037 seconds)

Similiar Articles:













7/24/2012 9:28:54 AM


Reply: