This topic is now archived and is closed to further replies.

Stupid char* question?

This topic is 5776 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hm, I don''t know how to begin... Well, I''ve got a friend who has a problem... :D Anyway, to keep this short I want to include quite a lot of text in my Windows program, and I will pass it all to an Edit Box using SendMessage with a char pointer as argument. So far all good! Now on to the embarrassing part... Since it''s a kind of long text, relatively speaking, I wonder how I can put this text into my code without it looking ugly... Is it possible to divide a char* text[] = "Some long text" into several lines, or do I have to place it all on one single line? I don''t like the one line approch that much really... Otherwise I will just turn the text into some custom resource, and get my char pointer from there, and the code will still look nice and all... How do you guys do when you have some text that you want included in the game?

Share this post

Link to post
Share on other sites
You can divide a string literal up with whitespace characters as much as you like. The compiler will concatenate consecutive string literal expressions within a statement to become a single expression. For example:
int main(void)
char *lps = "this is " "some"
" stuff";

1st law of programming: Any given program, when running, is obsolete.

Share this post

Link to post
Share on other sites