Hi,

I'm reading an int into a string, character by character.

By process of elimination the problem is with the while loop, but no with the contents of the while loop.

That is removing the while loop and typing the contents 5 times the program works (but lacks the generality the while loop provides)

I find it odd that including the while loop prevents ANY of my printf's from working. The idea is that the while stops once tPtr reaches the Null character.

Any ideas?

Code:
#include <stdio.h>

int main()
{
	char str[40];
	char tmp[10], *tPtr;
	int num[] = {1234, 5678, 8900, 1212};
	char *ptr;
	
	printf("test1\n\r");

	ptr = str;

	sprintf(tmp, "%d,", num[0]);
	
	printf("tmp %s\n\n", tmp);

	tPtr = tmp;

	while(tPtr)
	{	
		*ptr++=*tPtr++;
	}

	*ptr ='\0';

	printf("t1 %s", str);

return 0;

}
Thanks

Matt.