Fair enough. Lets do it properly and use a union.
union IPAddressConverter {
uint32_t ipInteger;
uint8_t ipArray[4];
};
void setup()
{
// This code will only run once, after each powerup or reset of board
IPAddressConverter ipAddress;
ipAddress.ipInteger = Ethernet.localIP();
char buf[16];
sprintf(buf, "%d.%d.%d.%d", ipAddress.ipArray[0], ipAddress.ipArray[1], ipAddress.ipArray[2], ipAddress.ipArray[3]);
//twitter.post(buf);
}
void loop()
{
// This code loops consecutively
}
Oh, I should also mention, you don't need the \0 at the end of sprintf(), it is included for you as part of the " "