0
char cTime[22];
sprintf(cTime, "%04s/%02s/%2s:%02s:%02s:%02s", year(), month(), day(), hour(), minute(), second());

This sprintf line causes this error:**B0100000063f694Š

Could someone help me debug this? Thank you.

jfpoilpret
9,1627 gold badges38 silver badges54 bronze badges
asked Oct 30, 2014 at 11:56

2 Answers 2

1

%s is string macro but output of year(),... is probably an integer type. Use %d or %u macros in format.

answered Oct 30, 2014 at 12:31
0
0

Yes - try making each of the %-specifiers match the kind of conversion you want for each variable in the rest of the call. F/ex, %d converts an integer to a string in decimal radix, %f converts a double to a number with a decimal fraction, etc. In all cases, the output will be as characters; you don't need to specify that.

answered Oct 30, 2014 at 18:10
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.