Converting an integer into a const char*

Hi Guys
I was trying to make a clock using a graphical LCD screen because I wanted to put animations on there. The screen I'm using is a DOGL128 and I am using a DS1307 RTC to keep the time. The library which comes with the screen has a string function where you can output text to the string, however it requires a const char in the parameter for the text and I wanted to be able to read the time from the chip and output it but I don't know how to convert integers into a const char.
Here is the link to the library I'm using --> http://www.lcd-module.com/support/application-note/arduino-meets-ea-dog.html It is the second link on the page

I would appreciate any help. Thanks

Without your code, we can only guess at what's wrong.

Be sure to read this, especially Step 7, when you Modify your post to include your code in between [code]...[/code] tags.

My guess is that you have an integer of some kind, but the library only takes char *. If that's the case, then something like this would work:

  char buf[12];
  lcd.string( col, page, font, itoa( value, buf, 10 ) );

Description of the itoa function (and many others you should know) is here. If that's not what you're trying to do, I just wasted my time guessing without your code.

Cheers,
/dev

Here is the code I have so far

#include <dog_7565R.h>
#include <font_16x32nums.h>
#include <font_6x8.h>
#include <font_8x16.h>
#include <font_8x8.h>
#include <logo_BLH.h>
#include <logo_small_BLH.h>

#include <Wire.h>
#include <Time.h>
#include <DS1307RTC.h>
dog_7565R DOG;
const int COMDATA = A0; //Pin 23 on ATMEGA328
const int SERIAL_IN = 1; //Pin 3 on ATMEGA328
const int LCD_DISP_RES = 3; //Pin 5 on ATMEGA328
const int LCD_DISP_SELECT = 10; //Pin 16 on ATMEGA328
const int SERIAL_CLK = 13; //Pin 19 on ATMEGA328

const int p_cs = LCD_DISP_SELECT;
const int p_si = SERIAL_IN;
const int p_clk = SERIAL_CLK;
const int p_a0 = COMDATA;
const int p_res = LCD_DISP_RES;
char T_HOURSONE[5]; //= String("hi");
void setup() {
// put your setup code here, to run once:
DOG.initialize(p_cs, p_si, p_clk, p_a0, p_res,DOGL128);
DOG.clear();
}

void loop() {
// put your main code here, to run repeatedly:
time_t t = 1457848800;
RTC.set(t);
//T_HOURS = hour(t);
//minutes = minute(t);
T_HOURSONE[5] = char(char(hour(t),DEC) + ":" + char(minute(t),DEC));
//char T_HOURSTWO[] = "hi";
DOG.string(25, 3, font_8x16,T_HOURSONE);
}

char(minute(t),DEC))

Do you have a clue what that is doing? I didn't think so.

Misusing the comma operator that way, you are effectively casting 10 to a char. Why do you want to do that?

char(char(hour(t),DEC)

Again, you are casting 10 to a char.

Then, you add 10 + ':' + 10, and cast the sum as a char.

Just because Serial.print(minute(t), DEC) does something does NOT mean that you can remove the Serial.print( and ) and have the same thing happen.

Something like:

char buf[50];
void loop()
{
  sprintf(buf,"%2d:%02d",hour,minute);
  lcd.string(25,3,font_8x16,buf);
}

The key is %02d. It formats an integer into a string with up to 2 digit numbers so if you have 2:05pm, then the 5 will be output into 05, what we expect.

PaulS - If you read what I said in my original post, I have to cast it into a const char* but I only know how to convert it into a char. I have to cast it into a const char* because that is the type which is required by the function DOG.string() in the last parameter

Thank you so much liudr for enlightening me to the serial print function. It worked!