Rob Dixon wrote:
> In C, newlines have to be introduced explicitly as "\n". A literal
> newline character (the end of a source record) has to be escaped to
> make it 'vanish', otherwise it should throw a compilation error.
>
> In Perl:
>
> my $string = "One
> Two
> Three
> ";
>
> In C:
>
> char *string = "One\n\
> Two\n\
> Three\n\
> ";
>
> or, because consecutive C string constants are implicitly concatenated:
>
> char *string =
> "One\n"
> "Two\n"
> "Three\n"
> ;
or don't quote them is you have an ANSI C compiler:
#define TEST(s) printf("%s\n",#s)
int main(int argc,char* argv[]){
TEST(xxxx\n
yyyy\n
zzzz\n
see you!);
}
prints:
xxxx
yyyy
zzzz
see you!
david
--
sub'_{print"@_ ";* \ = * __ ,\ & \}
sub'__{print"@_ ";* \ = * ___ ,\ & \}
sub'___{print"@_ ";* \ = * ____ ,\ & \}
sub'____{print"@_,\n"}&{_+Just}(another)->(Perl)->(Hacker)
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>