From: proxy foxy on
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
From: Andrew Gabriel on
In article <16621031-3fd9-417f-bfe3-f598b691141f(a)j12g2000pri.googlegroups.com>,
proxy foxy <clcfans(a)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]
 | 
Pages: 1
Prev: Solaris 2.5 anyone?
Next: really heavy asvc_t