What happens to printfs when code run on real non interactive system?

Hi All,

I’m attempting to make a modification so that output from my printfs can be viewed via a web page. To do this I’ve hacked DC’s printf function to make a copy of it’s output into my own buffer. This works fine when I’m running my program in “development mode”, downloading from the USB cable. When I run my program in normal “deployment mode” however, by debug buffer is always empty as if the printfs are never being called. Can anyone explain what could be going on here?


// References to externally defined debug buffer, used to store a
// copy of printfs
extern char g_DebugBuffer[];
extern int g_DebugBufferIndex;

int _printf(char far*fmt,char *args)
	auto int __printfcnt, __cnt;
    int i;

   // __printfbuf can't be far -- it's passed to __qe2 (by way of doprnt)
   // which passes it to dkDoMsg() and _stdioSerialOut(), two assembly
   // functions that expect a near pointer.
	auto char __printfbuf[STDIO_MAX_PRINTF_BUF_SIZE];

	__printfcnt = 0;
	doprnt(__qe2, fmt, args, NULL, __printfbuf, &__printfcnt);
	__cnt = __printfcnt;
	__qe2(0, __printfbuf, &__printfcnt, NULL);

   if(__printfbuf[0] != 0)
		if (OPMODE & 0x08)
			dkDoMsg(__printfbuf);  // xmit buffer to stdout window for debug mode
		dkDoMsg(__printfbuf);  // xmit buffer to stdout window

    // append printf output to circular g_DebugBuffer
    for (i = 0;__printfbuf[i] != 0;i++) {
    	g_DebugBuffer[g_DebugBufferIndex] = __printfbuf[i];
        g_DebugBufferIndex = (g_DebugBufferIndex + 1) % DEBUG_BUFFER_SIZE;
	g_DebugBuffer[g_DebugBufferIndex] = 0;
    // leave index at pointer to null terminator, so this gets overwritten
    // on the next call

	return __cnt;