Dave's Brain

Browse - programming tips - visual c 2008 sprintf time t

Date: 2010mar23
Language: C/C++

Q.  How do I deal with time_t in an _snprintf() ?

A.  As of Visual Studio 2005, it is 64 bits so do:

	char	buf[100];
	time_t	now;

	now = time(NULL);
	_snprintf(buf, sizeof(buf), "time=%I64d seconds", now);
What this info useful to you? You can donate to say thanks

Add a comment

Sign in to add a comment
Copyright © 2008-2012, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.
Advertisements: