Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

strccpy

12 views
Skip to first unread message

proxy foxy

unread,
Jun 3, 2010, 12:42:06 AM6/3/10
to
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

Andrew Gabriel

unread,
Jun 3, 2010, 4:32:22 AM6/3/10
to
In article <16621031-3fd9-417f...@j12g2000pri.googlegroups.com>,

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 new messages