Advertisement

Stupid char* question?

Started by February 20, 2002 03:30 AM
2 comments, last by En3my 22 years, 8 months ago
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:
  int main(void){		char *lps = "this is " "some"		" stuff";}  


--
1st law of programming: Any given program, when running, is obsolete.
Advertisement
great! Just what I needed... :D
You might want to use a string table resource. Look up LoadString() function. I use string tables with MFC''s CString, which takes care of memory management issues.
---visit #directxdev on afternet <- not just for directx, despite the name

This topic is closed to new replies.

Advertisement