Problem with casting to string.

Im working on a sort of simple home made weather station. I have a BMP085 barometric sensor and and lcd color shield from sparkfun.com. both are setup correctly and working. No the code that reads and converts the temprature is a short. i tried to cast it to a string and char. i tried to concat the short to a string. But nothing seems to work.

#include <Wire.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <ctype.h>
#include <avr/io.h>
#include <avr/interrupt.h>
#include <avr/pgmspace.h>
#include "WProgram.h"
#include "HardwareSerial.h"
//    External Component Libs
#include "LCD_driver.h"

#define BMP085_ADDRESS 0x77  // I2C address of BMP085

const unsigned char OSS = 0;  // Oversampling Setting

// Calibration values
int ac1;
int ac2; 
int ac3; 
unsigned int ac4;
unsigned int ac5;
unsigned int ac6;
int b1; 
int b2;
int mb;
int mc;
int md;

// b5 is calculated in bmp085GetTemperature(...), this variable is also used in bmp085GetPressure(...)
// so ...Temperature(...) must be called before ...Pressure(...).
long b5; 

short temperature;
long pressure;


void setup() {
//  Serial.begin(9600);
  // BMP085 setup:
  Wire.begin();
  bmp085Calibration();
  
  // LCD Setup:
  ioinit();           //Initialize I/O
  LCDInit();	      //Initialize the LCD
  LCDContrast(44);    // Set Contrast
  LCDClear(WHITE);    // Clear LCD to a solid color
  
}

void loop()
{
  temperature = bmp085GetTemperature(bmp085ReadUT());
  pressure = bmp085GetPressure(bmp085ReadUP());
  LCDPutStr("Temprature: ", 0, 4, BLACK, WHITE);
  LCDPutStr(temperature, 0, 10, BLACK, WHITE);
  /*
  Serial.print("Temperature: ");
  Serial.print(int(temperature *0.1) , DEC);
  Serial.println(" deg C");
  Serial.print("Pressure: ");
  Serial.print(pressure / 100, DEC);
  Serial.println(" hPa");
  Serial.println();
  delay(1000);
  */
}

im not sure how to get the temperature to display on the screen. The documentation for the LCDputStr tells me the first argument shuld be a string but when compile the cod i get a diffrent error:

74: error: initializing argument 1 of 'void LCDPutStr(char*, int, int, int, int)'

so I’m a bit at a loss here.

Try this:

char buf[4];
LCDPutStr("Temperature: ", 0, 4, BLACK, WHITE);
snprintf(buf,4,"%d",temperature);
LCDPutStr(buf, 0, 10, BLACK, WHITE);

Thats it, it works now! Thank you very mutch!

if im reading this correct, the snprintf function makes an array from the temprature variable?

int snprintf(char *str, size_t size, const char *format, ...);

snprintf() produces an output [u]size[/u] bytes (4 in this case) long according to [u]format/u and writes it to the character string [u]str[/u].