Now I'm studying vector of structs, and attempt to print it after sorting by ppid. In this process, I want to test "'the string value' is saved well", but some junk value is saved this space like below picture.
:: Second value "contest.exe" is saved well,
::but, as you see, the first value "Microsoft.VsHub~" is saved like "?(triangle)"
Why this problem occured, and how to solved it?
This is my structure,
struct process {
string procName;
DWORD procPid;
DWORD procPpid;
};
main(){
...
std::vector <process*> myProcess;
...
}
Save value like,
process* p = new process();
p->procName = pe32.szExeFile;
p->procPid = pe32.th32ProcessID;
p->procPpid = pe32.th32ParentProcessID;
myProcess.push_back(p);
and print this
_tprintf(TEXT("[%s]"), pe32.szExeFile);
_tprintf(TEXT(" %s \n"), myProcess[i]);
_tprintf(TEXT("[%d]"), myProcess[i]->procPid);

stringastd::string?std::vector<process>) instead.value > smart pointer > pointer.