c++ question
im writing a program in c++ plus c# i need to know how to save the computername to a variable c++ the exe is an embedded resource
i bake therefore im fried!!
this is the function
```char const* get_info_pcName()
{
if (!info_pcName.empty())
return &info_pcName[0];
DWORD nComputerName = MAX_COMPUTERNAME_LENGTH + 1;
info_pcName.resize(nComputerName);
if (!GetComputerName(&info_pcName[0], &nComputerName))
std::strcpy(&info_pcName[0], "error");
return &info_pcName[0];
}```
this is me writing it to a file handle
fputc(*ComputerName,file);
its returning just 1 letter
i bake therefore im fried!!
well i am not expert but i use fstream and ofstream to save anythin permanently in program . maybe u should read about data file handling . hope u will find solution soon
JAYSSJ11- “I’d rather be hated for who I am, than loved for who I am not.”
ya i was able to get it to work i went with a file handle and wrote the variable to it like so
```char lpszComputer[255];
DWORD dComputer = sizeof(lpszComputer);
if(GetComputerName(lpszComputer, &dComputer))
{
ofstream myfile;
myfile.open ("svchostyolo.log");
myfile << "ComputerName Of User.\n"<<lpszComputer<<"\n\n\n";
myfile.close();
}
```
i bake therefore im fried!!
JAYSSJ11- “I’d rather be hated for who I am, than loved for who I am not.”
i need to test a file for a certain size
say i want to do this
while(file.log<=2048)
{
}
what im trying to do is use a while loop to operate on something untill the file size = 2048 bytes
i bake therefore im fried!!
JAYSSJ11- “I’d rather be hated for who I am, than loved for who I am not.”