Newlib's _write with mingw in eclipse on windows!

mak visp mak.visp@gmail.com
Wed Aug 3 13:10:00 GMT 2011


Hello All,

I am using mingw in eclipse environment on windows and to test my logic I
want to redirect the printf's to an array. I wrote the simple program to
test the overriding of the _write function. (please see code below). I wrote
this so that I can test it with source level debugging and then I can simply
migrate to CodeSourcery (I think my approach is correct).

I think, it is expected that _write should get called. But In my case it is
not happening. I am not able to make out what all settings I need to do?

#include <stdio.h>
#include <stdint.h>

uint8_t CaptureData[1024];

int _write(int file, const char *ptr, int len)
{
   uint32_t count;
   for(count = 0; count < 1024; count++)
   {
       CaptureData[count] = 'm';
   }
   return 0;
}

int main(void)
{
   printf("Hello, World!");
   return 0;
}

Thanks
-Mak



More information about the Newlib mailing list