displaying whole numbers

Using UTFT library.

How do I display whole numbers. I tried different things. It’l work for a couple of seconds, then revert back to displaying the decimals.

Here’s the basic code

Tried (boost, 140, 190, 0), (boost, 140, 190, 2)

  float volt =  analogRead(A0) * .0048852;
  float psia =  (volt * 12.133);
  int boost = psia - 14.7;

 myGLCD.printNumI(boost, 140, 190);

.h and .cpp

Tried replacing “long num” to “int num”

printNumI(int num, int x, int y, int length=0, char filler=' ');
void UTFT::printNumI(int num, int x, int y, int length, char filler)
{
	char buf[25];
	char st[27];
	boolean neg=false;
	int c=0, f=0;
  
	if (num==0)
	{
		if (length!=0)
		{
			for (c=0; c<(length-1); c++)
				st[c]=filler;
			st[c]=48;
			st[c+1]=0;
		}
		else
		{
			st[0]=48;
			st[1]=0;
		}
	}
	else
	{
		if (num<0)
		{
			neg=true;
			num=-num;
		}
	  
		while (num>0)
		{
			buf[c]=48+(num % 10);
			c++;
			num=(num-(num % 10))/10;
		}
		buf[c]=0;
	  
		if (neg)
		{
			st[0]=45;
		}
	  
		if (length>(c+neg))
		{
			for (int i=0; i<(length-c-neg); i++)
			{
				st[i+neg]=filler;
				f++;
			}
		}

		for (int i=0; i<c; i++)
		{
			st[i+neg+f]=buf[c-i-1];
		}
		st[c+neg+f]=0;

	}

	print(st,x,y);
}

Here's the basic code

Here's the basic answer: POST ALL OF YOUR CODE!

Forgot to update thread. Got it working already. Hazardminds code. Used sprintf

Codes for others reference.

char value [4] = (0);
sprintf (value, "%3d", boost);
myGLCD.print (value,130,190);