Well, I went ahead and implemented what matsp suggested and it worked.
Code:
time_t rawtime;
struct tm * timeinfo;
char buffer [80];
time ( &rawtime );
timeinfo = localtime ( &rawtime );
string filePath = "C:\\Kysat\\Ground Station\\Sent Packets";
strftime(buffer,80, "%a_%b_%d__%H_%M_%S__%Y", timeinfo);
string fileName = buffer;
fileName += ".txt";
filePath += "\\" + fileName;
string packetString = "";
cout << filePath << endl;
char fullName[100];
for(int i = 0; i < filePath.length(); i++)
{
fullName[i] = filePath[i];
}
for(int i = 0; i < (int)pkt_size; i++)
{
packetString += packet[i];
}
ofstream packetsent(fullName);
packetsent << packetString << endl;
packetsent.close();
As for why I made a character array instead of doing filePath.c_string(), I tried that, but got compile errors, so decided to do something different. I may try again like that if I've got time later.
Thanks for the help.