file path read in

M

Mike

Hi
this worked before and I've no clue why now this messes up the path.
(still compiles)
---------
string Texstr = filep;
string::size_type n = Texstr.find_last_of('/');
if(n == string::npos) XPLMDebugString("Texturefolder not found.
\n");

Texstr = Texstr.substr(0, n+1);
strcpy(TextureFileName, Texstr.c_str ());
strcat(TextureFileName, pFileName);
-------
filep is a path like: users/michael/bla/blyy
pFileName is a pointer alike: images/blue.png
and I need: users/michael/bla/images/blue.png
Many thanks
Michael
 
V

Victor Bazarov

Hi
this worked before and I've no clue why now this messes up the path.
(still compiles)
---------
string Texstr = filep;
string::size_type n = Texstr.find_last_of('/');
if(n == string::npos) XPLMDebugString("Texturefolder not found.
\n");

Texstr = Texstr.substr(0, n+1);
strcpy(TextureFileName, Texstr.c_str ());
strcat(TextureFileName, pFileName);

See FAQ 5.8. (http://www.parashift.com/c++-faq-lite/)

V
 
F

Francesco S. Carta

Cannot find..if u would have a clue it would have been less to write 4
u

The link Victor pointed out was not to the solution to your problem, but
to the instructions on how to post here in order to get proper help.

Follow the instructions on FAQ 5.8 and post the adequate code here, only
then we will have enough information to help you solve the issue.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,145
Messages
2,570,828
Members
47,374
Latest member
anuragag27

Latest Threads

Top