simple string concatenation question
-
Hi guys, I am trying to add double slashes in front of a string, I am wondering it can be done as below Assuming both variables have contained some characters char *FileString; // a pointer to character string char Buffer[256]; // an array to 256 characters FileString = '//' + Buffer; Please advise, Thanks alot
-
Hi guys, I am trying to add double slashes in front of a string, I am wondering it can be done as below Assuming both variables have contained some characters char *FileString; // a pointer to character string char Buffer[256]; // an array to 256 characters FileString = '//' + Buffer; Please advise, Thanks alot
Use
strcat()
-Nick Parker -
Hi guys, I am trying to add double slashes in front of a string, I am wondering it can be done as below Assuming both variables have contained some characters char *FileString; // a pointer to character string char Buffer[256]; // an array to 256 characters FileString = '//' + Buffer; Please advise, Thanks alot
-
Hi guys, I am trying to add double slashes in front of a string, I am wondering it can be done as below Assuming both variables have contained some characters char *FileString; // a pointer to character string char Buffer[256]; // an array to 256 characters FileString = '//' + Buffer; Please advise, Thanks alot
C-style strings don't work like that. You should be using std::string unless there is an overriding reason not to:
std::string FileString;
std::string Buffer = "some stuff...";FileString = "//" + Buffer;
--Mike-- THERE IS NO THERE IS NO BUT THERE IS MAGIC PIXIE DUST BUSINESS GENIE CODE PROJECT Homepage | RightClick-Encrypt | 1ClickPicGrabber "You have Erica on the brain" - Jon Sagara to me
-
C-style strings don't work like that. You should be using std::string unless there is an overriding reason not to:
std::string FileString;
std::string Buffer = "some stuff...";FileString = "//" + Buffer;
--Mike-- THERE IS NO THERE IS NO BUT THERE IS MAGIC PIXIE DUST BUSINESS GENIE CODE PROJECT Homepage | RightClick-Encrypt | 1ClickPicGrabber "You have Erica on the brain" - Jon Sagara to me
-
Thanks guys, I tried not to use std::string as I am not sure if it's portable to Embedded Visual C++. I am doing the program using Visual C++ and expecting to make it workable on iPAQ when re-compling.
AFAIR STL is not avaliable in eMbedded Visual C++ - Anders Money talks, but all mine ever says is "Goodbye!"
-
Use
strcat()
-Nick Parker -
Hi guys, I am trying to add double slashes in front of a string, I am wondering it can be done as below Assuming both variables have contained some characters char *FileString; // a pointer to character string char Buffer[256]; // an array to 256 characters FileString = '//' + Buffer; Please advise, Thanks alot
strcpy(FileString, "//"); strcat(FileString, (char *) Buffer); Brian