[lug] OT: My own C/C++ mix Q
D. Stimits
stimits at idcomm.com
Wed Apr 17 13:23:29 MDT 2002
Ok, I have some legacy C (and you thought C didn't have
inheritance...heheh) being compiled under g++. One of the legacy code
snippets uses strftime(), and all it is used for is to format the year.
This warning always generates:
warning: `%c' yields only last 2 digits of
year in some locales
Does anyone know if there is a newer method of formatting time and
getting year out of "struct tm", the underlying struct producing the
unformatted time data, such that it does not issue this warning (and I
won't turn off warnings, I am looking to see if there was something new
created to deal with that locale warning)?
Second, on sscanf() and sprintf(), a %lu can be used for an unsigned
long format. I *think* %llu is good for the 64 bit unsigned long long,
or at least the warnings go away (this is on g++ RH 7.1). Is %llu the
correct format string for 64 bit unsigned longs (my references are too
old to even know about long long)?
D. Stimits, stimits at idcomm.com
More information about the LUG
mailing list