This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Newlib's _write with mingw in eclipse on windows!
- From: mak visp <mak dot visp at gmail dot com>
- To: newlib at sourceware dot org
- Date: Wed, 3 Aug 2011 11:23:47 +0530
- Subject: Newlib's _write with mingw in eclipse on windows!
- References: <CAKPaLSp7cXJ4kKbvCTmyPgztWbmcXyjKd=k=W700sW4vv-V_Fg@mail.gmail.com>
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