Stupid char* question?
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?
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:
--
1st law of programming: Any given program, when running, is obsolete.
int main(void){ char *lps = "this is " "some" " stuff";}
--
1st law of programming: Any given program, when running, is obsolete.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement