Print Date and Time In Visual Studio C++ build?

后端 未结 5 1120
故里飘歌
故里飘歌 2020-12-17 23:49

How would I print the date and time for the purposes of the build. Ie: When the console for my application starts up I want to do this:

Binary B         


        
5条回答
  •  轮回少年
    2020-12-17 23:55

    One way of doing this would be using the built-in __DATE__ and __TIME__ macros. From MSDN (for VS 2005):

    __DATE__: The compilation date of the current source file. The date is a string literal of the form Mmm dd yyyy. The month name Mmm is the same as for dates generated by the library function asctime declared in TIME.H.

    __TIME__: The most recent compilation time of the current source file. The time is a string literal of the form hh:mm:ss.

提交回复
热议问题