convert char[] to string

O

ofranko

this seem to be working better... i have the system date in a char
array.(it's the only way i could find) .. char dateBuffer1[10] i
need to get to std::string theDateBuffer ..any ideas?


class TheDate
{
public:
TheDate(std::string initialDateBuffer);
~TheDate();
std::string GetDateBuffer();
void SetDateBuffer(std::string dateBuffer);
//void DisplayDate(std::string theDateBuffer[9]);

private:
std::string theDateBuffer;
char dateBuffer1[10];
};

TheDate::TheDate(std::string initialDateBuffer)
{
theDateBuffer = initialDateBuffer;
}

TheDate::~TheDate()
{
}

std::string TheDate::GetDateBuffer()
{
cout <<"GetDateBuffer()\n";
return theDateBuffer;
}

void TheDate::SetDateBuffer(std::string dateBuffer)
{cout<< "SetDateBuffer()";
// dateBuffer doesn't work this way
dateBuffer = _strdate_s( dateBuffer1);//gets system date
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Access violation??? 2
Help with code 0
Chatbot 0
Collect Excel Data from Website 5
sorting char array 13
std::string and char[] comparisons 11
Date format 1
How can I fix my pattern coding error in c++ 0

Members online

No members online now.

Forum statistics

Threads
473,990
Messages
2,570,211
Members
46,796
Latest member
SteveBreed

Latest Threads

Top