Char * to stringc

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
netpipe
Posts: 670
Joined: Fri Jun 06, 2008 12:50 pm
Location: Edmonton, Alberta, Canada
Contact:

Char * to stringc

Post by netpipe »

was wondering how to get a char * into a stringc. tried some of the following without luck.


char * model,texture;
stringc model2,texture2;
std::string model3,texture3;

model2 = "data/models/vehicles/oldChevy-Truck.3ds";
texture2 = "data/models/vehicles/oldChevy.bmp";


//model3 = model;
//texture3 = texture;

//todo figure out stringc copy to string

//model2 = model3.c_str();
//texture2 = texture3.c_str();

//strcpy(model,model2); // possibly a 20 char limitation
//strcpy(texture,texture2);
//model2 = &model;
//texture2 = &texture;

//model2 = stringc(model);
//texture2 = stringc(texture);
Live long and phosphor!
-- https://github.com/netpipe/Luna Game Engine Status 95%
Agent_X
Posts: 41
Joined: Sun Sep 16, 2012 3:44 am

Re: Char * to stringc

Post by Agent_X »

Non-pointer version #1:

Code: Select all

stringc model2 = stringc("data/models/vehicles/oldChevy-Truck.3ds");
Non-pointer version #2:

Code: Select all

const char* model = "data/models/vehicles/oldChevy-Truck.3ds";
stringc model2 = stringc(model);
Non-pointer version #3:

Code: Select all

stringc model2;
model2 = "data/models/vehicles/oldChevy-Truck.3ds";
Pointer #1:

Code: Select all

stringc* model2 = new stringc("data/models/vehicles/oldChevy-Truck.3ds");
Pointer version #2:

Code: Select all

const char* model = "data/models/vehicles/oldChevy-Truck.3ds";
stringc* model2 = new stringc(model);
Pointer version #3:

Code: Select all

stringc* model2 = new stringc();
*model2 = "data/models/vehicles/oldChevy-Truck.3ds";
netpipe
Posts: 670
Joined: Fri Jun 06, 2008 12:50 pm
Location: Edmonton, Alberta, Canada
Contact:

Re: Char * to stringc

Post by netpipe »

figured out that my issue was with

char * test1,test2 ; is not the same as char * test1,*test2

thanks for the reply
Live long and phosphor!
-- https://github.com/netpipe/Luna Game Engine Status 95%
Post Reply