Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Printing time_t in a vector struct member

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!!

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Try this:

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

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading