[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: What is the preferred way to embed multi-line string in C source?
- From: Rob Hoelz <rob@...>
- Date: Thu, 18 Dec 2008 23:13:05 -0600
"pan shizhu" <email@example.com> wrote:
> Hi all,
> The question is probably more C-related rather than Lua-related.
> I want to use Lua inside C program and sometimes it would be
> convenient if I can write lua source inside a C string.
> As far as I know the ISO standard for C requires the quotation mark
> "" to be within one single line. (Though actually most C compilers
> allow multi-line string inside ""). May I ask if there's an
> ISO-compliant way to embed multi-line string in C program?
> Pan, Shi Zhu
I believe you can do the following:
char *luaCode = "function foo()\n"
Not ideal, but hey, it works.