|
-
March 16th, 2010, 06:26 AM
#1
converting stringc to char* ?
Hello Guru's...
I am on an adventure to learn C++, some background in different scripting languages so I am so used to having my hand held when it comes to dealing with variables.
There is a simple way to handle this I would hope, I use this a lot in my applications but need assistance in looking for the easy way to handle, maybe a function or something? Right now, I cant get this to work at all unless I specify the string in total without adding any dynamic variables.
core::stringc itemnumber = "001";
core::stringc my_string1;
core::stringc my_string2;
core::stringc my_string3;
core::stringc my_string4;
char* myexc;
my_string1 = "select * from itemtable where item='"; //stringc
my_string2 = itemnumber; //stringc
my_string3 = "' order by itemnumber";
my_string4= my_string1 + my_string2 + my_string3;
//myexc = "select * from itemtable where itemnumber='001' order by itemnumber"; // This works.
if(!db.Execute(my_string4,tbl)) // Error 2440 is here.
The error I get is:
main.cpp(100) : error C2440: '=' : cannot convert from 'irr::core::stringc' to 'char *'
I have read several pages, articles and simply cannot seem to put this together correctly. Also, just a note, this is burried within a switch statement, so, assigning the var types has to be done outside of this case statement. At anyrate, it seems to me that I need to know how to place my_string4 into either a char* or convert it to a char* that the db.execute understands.
Any help would be greatly appreciated. I would really like to understand this...
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|