Printing time_t in a vector struct member

Advertisements

Sorry, I think this might be a silly question. While trying to use ctime to print a time_t inside a vector struct member, the compiler throws me this error argument of type "time_t" is incompatible with parameter of type "const tm *"

struct Trade_Record
{
    std::time_t PASP;
};

std::vector<Trade_Record> Trade_Records;


for (std::vector<Trade_Record>::iterator begin = Trade_Records.begin(); begin != Trade_Records.end(); begin++)
{
    std::cout << ctime(begin->PASP) << endl;
}

How could I print time_t inside a vector struct member? Thank youuu!!

>Solution :

Try this:

    std::cout << ctime(&begin->PASP) << std::endl;

Leave a ReplyCancel reply