client.publish esp8266

Hello, i am a beginner.

client.publish("outTopic",msg) wiht "Hello World " is ok.

But i will publish a distance Value.

I changed the example form

snprintf (msg, 50, "hello world #%ld", value);

to

snprintf (msg, 50,(char*)ent , value);

But ist is not ok so, can anyone help me.

ent = entfern(); / ent is a long / in this is the distance value
Serial.print(ent);
Serial.println(" cm");
delay (1000);

client.loop();

long now = millis();
if (now - lastMsg > 2000) {
lastMsg = now;
++value;
snprintf (msg, 50,(char*)ent , value);
// snprintf (msg, 50, "hello world #%ld", value);
// Serial.print("Publish message: ");
// Serial.println(msg);
client.publish("outTopic",msg);

}}

Thank you Manuela

Try:

snprintf (msg, 50, "hello world #%ld", ent);

wildbill:
Try: short life

snprintf (msg, 50, "hello world #%ld", ent);

In any case thank you for helping me.