I'm using an Ethernet shield and I want to output the uptime of the shield. I'm doing with millis() / 1000 which gives me a long of the uptime in seconds. I need to convert this to a char array so I can send it to the shield. I've been doing everything with sprintf() but sprintf() on avr doesn't appear to handle longs correctly?
unsigned long num = 1099511627776; char mystr; sprintf(mystr,"Millis: %u",num); Serial.println(mystr);
I get 0 if I run this code. Other large numbers output either 1 or 2. If I use a standard int it's fine. What's the best way to convert a long to a string if sprintf() won't work?