fdevopen changed in new compiler version?

Go To Last Post
5 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi All,

I tried recompiling an old project with a newer winavr version (still one year old though), but get an error for my fdevopen call. It did work on an older version.

main.c:129: warning: passing arg 1 of `fdevopen' from incompatible pointer type
main.c:129: error: too many arguments to function `fdevopen'

The relevant code itself is:
#include

fdevopen(PutChar,0,0);

int PutChar (char c)
{
if (c == 0x0A)// \n
AddByteToBuffer (0x0D);
AddByteToBuffer (c);
return 0;
}

Should PutChar have another type than int?
Should I shutup until I have tried the newest build of winavr? :-)
Any other ideas? I couldn't find a similar problem searching the forum.

Best regards,
Igor

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

It has been changed about 1.5 years ago, and this API change has been
the major reason for switching the avr-libc version number from 1.2
to 1.4.

Please read the documentation...

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Jörg,

No disrespect to the people that have put the enormous amount of work into the documentation, but some concepts are quite difficult to grasp for the occasional hobby programmer. IO streaming is one of them for me and the libc manual is not written for beginners. (nor should it be)

I'll go see if I can find some code to steal in the projects section.

Igor

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

> I'll go see if I can find some code to steal in the projects section.

Why don't you simply start with the stdiodemo from avr-libc?

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Oh, there is an example demo :oops:
That should solve it.

Thanks Jörg.