Jump to content

Home

String Help.


GangsterAngel

Recommended Posts

U have a small problem.

 

im making a model preview on the player selection window.

like the "Build A Jedi" model preview.

 

i have a problem. i dont know how to get the left of '/'

to get the model name.

 

thats the only thing stopping my code from working :(.

 

for example if i have

 

"stormtrooper/default" as the 'Model' Cvar.

strrchr(model,'/') would give me '/default'

 

and i need to know what would return "stormtrooper/".

 

Help appreciated.

Link to comment
Share on other sites

char *point = strrchr(model,'/');

point++; //advances to the character after the '/'.

point = '\0'; //sets the char to be the end of life special char.

 

//At this point, your 'model' should read "stormtrooper/". I beleive this is how the rest of the code strips the strings like.

Link to comment
Share on other sites

Ah, my bad. I missed the pointer reference when setting the end of file character. IE my sample code should have been....

 

char *point = strrchr(model,'/');
point++; //advances to the character after the '/'.
*point = '\0'; //sets the char to be the end of life special char.'

Good job figuring it out. :)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...