Go Down

Topic: Showing year as three digits! (Read 663 times) previous topic - next topic

James C4S

You defined test to be 20 characters long.  Sprintf() puts a null character at the end, which takes up a character.  Test needs to be bigger.

I'm not sure I understand what you are doing with the variable "chars".  sprintf returns the number of characters written.  "chars" isn't an int, it is an array of characters, why?
Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

picmetoo

Thanks James C4S,
I Increased it to 30 characters and it works fine.

Go Up