C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Error returning a string

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++)
View previous topic :: View next topic  
Author Message
solarin
Guest





PostPosted: Fri Aug 25, 2006 9:10 am    Post subject: Error returning a string Reply with quote



Hi,

I've the following code:

//all variables are defined in the code

Class CMessage{

string CMessage::GenerateString()
{

string finalmessage;
stringstream s;
s << codeClass;
finalmessage = "CODE: "+s.str() + " - ";
//finalmessage = codeClass + "----";
finalmessage = finalmessage + messageClass + " - ";

return finalmessage;
}

}

//A.h

Class A {
public:
string StringToLogger(MessagesNotifier_Client* client, CMessage
*msg)
private:
string msgToLogger;
}


// A.cpp

string A::StringToLogger(MessagesNotifier_Client* client,CMessage
*msg)
{
msgToLogger = msg->GenerateString(); // Error here.
invokerClass = typeid( client ).name();
msgToLogger = msgToLogger + invokerClass;
msgToLogger = msgToLogger + "----";
// Enviamos: "Codigo_de_error" + ---- + "miss de error" + ---- +
"Nombre de la classe"
return msgToLogger;

}

}


Inside de class A I'm calling the method "GenerateString()" from class
CMessage. This method must return a string. The method is generates
the string without problems. The error is when the result from
"msg->GenerateString()" must be placed in msgToLogger.

the Error is:
Access violation reading in 0xcdcdcdf1.
Access violation writting in 0xcdcdcdcd.


Any ideas or hints to solve it?
Back to top
Guest






PostPosted: Fri Aug 25, 2006 9:10 am    Post subject: Re: Error returning a string Reply with quote



solarin wrote:
Quote:
Hi,

I've the following code:
[snip]
string A::StringToLogger(MessagesNotifier_Client* client,CMessage
*msg)
{
msgToLogger = msg->GenerateString(); // Error here.

the Error is:
Access violation reading in 0xcdcdcdf1.

You need to pass a CMessage object.

HTH,
Michiel Salters
Back to top
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.