This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Newlib's _write with mingw in eclipse on windows!


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]