Computing.Net > Forums > Programming > Mixing strings in C++?

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Mixing strings in C++?

Reply to Message Icon

Name: Leo the 28C (by Sulfurik)
Date: September 24, 2005 at 12:41:42 Pacific
OS: Windows XP Home SP2
CPU/Ram: 2.8 GHz/448 MB
Comment:

Hello everyone! :-D
OK, look at this:

[code]
// Char array for holding map file (*.LMC) name
char MAP_FILE[256];

// Query
printf("Please type in the name of the map you want to use: ");

// Get
gets(MAP_FILE);

// Change the title
// ERROR HERE
SetConsoleTitle("Mazzee - Prototype 3 - \"" + MAP_FILE + "\" Map");
[/code]

I get this error:

mazzee.cpp:175: error: invalid operands of types `const char[25]' and `char[256]
' to binary `operator+'

How do I fix it? MAP_FILE is a filename, so it has to be 256 letters long... Thanks! ;-)

http://www.xthost.info/sulfurik/
http://tsfc.ath.cx
ftp://tsfc.ath.cx
hotline://tsfc.ath.cx

Ruffle Mayo says ROFLMAO! :D




Sponsored Link
Ads by Google

Response Number 1
Name: ramkrishna836152
Date: September 26, 2005 at 00:14:09 Pacific
Reply:

Why not you try the library functions available in string.h

try using string concat function available in the library rather using the binary concatenation operator(+). They produce less errors.

thanks,


ramkrishna k.


0

Response Number 2
Name: Leo the 28C (by Sulfurik)
Date: September 26, 2005 at 07:54:26 Pacific
Reply:

Ooohh... Yeah, I'll try that as soon as I solve another problem that arised... Much thanks! ;-)

http://www.xthost.info/sulfurik/
http://tsfc.ath.cx
ftp://tsfc.ath.cx
hotline://tsfc.ath.cx

Ruffle Mayo says ROFLMAO! :D


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Mixing strings in C++?

an array of strings in C www.computing.net/answers/programming/an-array-of-strings-in-c/7230.html

String cutting in C www.computing.net/answers/programming/string-cutting-in-c/7277.html

Copying String to String In C www.computing.net/answers/programming/copying-string-to-string-in-c/699.html