I have some classes that i use to read the memory of a program. i made a function in that class to show the name of another class to shorten my code. Problem im having is that when i call my finction to print the text it has junk chars after it has got the right string, i have this working fine if i read the string outside of the class. i have tried both std::string and char*
class StringClass
{
public:
char pad_0x0000[0x4];
__int32 size;
char String[150];
};//Size=0x003C
class CProgramName
{
public:
char pad_0x0000[0x2C]; //0x0000
DWORD Name; // StringClass
std::string GetName()
{
if (!ISVALID(this->Name)) return "";
StringClass ServerName = Read<StringClass>((DWORD)this->Name);
return Name.String;
}
};
printf_s("Name %s", ProgramName.GetName().c_str());
Aucun commentaire:
Enregistrer un commentaire