|
From: | Marjan Fojkar |
Subject: | [avr-gcc-list] Standard IO - function fwrite |
Date: | Sat, 02 Jun 2007 17:33:38 +0200 |
User-agent: | Thunderbird 1.5.0.10 (X11/20070301) |
Hello!Has anyone used function fwrite? I think it does not return right value. It should return number of objects successfully written but in my case it returns written character. I also write zeros through ostream so i had to write this way: while(fwrite(&s_out_pool.m_buffer[s_out_pool.m_read_idx], 1, 1, ostream) >= 0)
{/* do something */} Right way would be:while(fwrite(&s_out_pool.m_buffer[s_out_pool.m_read_idx], 1, 1, ostream) > 0)
{/* do something */} Thanks, Marjan
[Prev in Thread] | Current Thread | [Next in Thread] |