 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
solarin Guest
|
Posted: Fri Aug 25, 2006 9:10 am Post subject: Error returning a string |
|
|
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
|
Posted: Fri Aug 25, 2006 9:10 am Post subject: Re: Error returning a string |
|
|
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 |
|
 |
|
|
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
|
|