Converting c++ string to int

前端 未结 5 1639
天命终不由人
天命终不由人 2021-01-01 06:59

I have the following data in a c++ string

John Doe 01.01.1970

I need to extract the date and time from it into int variables. I tried it li

5条回答
  •  感动是毒
    2021-01-01 07:09

    As far as I can tell, atoi does what you need.

    "Parses the C string str interpreting its content as an integral number, which is returned as an int value."

    http://www.cplusplus.com/reference/clibrary/cstdlib/atoi/

提交回复
热议问题