4 messages in net.java.dev.jna.usersAW: [jna-users] converting std::strin...
FromSent OnAttachments
Schneider JannMay 5, 2009 2:22 am 
Schneider JannMay 5, 2009 5:24 am 
Timothy WallMay 5, 2009 6:05 am 
Schneider JannMay 5, 2009 6:09 am 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:AW: [jna-users] converting std::string to const char* and returning it Actions...
From:Schneider Jann (j.sc@ssi-schaefer-noell.com)
Date:May 5, 2009 5:24:35 am
List:net.java.dev.jna.users

Hi,

I solved my problem on the c++ side this way:

string strFilename = saveInternally(); char* cFilename = new char[strfilename.length()]; strcpy(cFilename, strFilename.c_str()); return cFilename; ...

I don't really understand, why i have to do an extra strcpy(..) in this case of returning the string value and in other cases, when i use the string internally i dont have to.. Can anyone please explain this behaviour to me?

regards Jann