Porting C Code to Arduino and Compiler Errors

Removed.

The compiler is also gives error for "MS_TIMER". How do I change it to fit Arduino syntax?

Now that depends on what you expect a MS_TIMER to be.

It looks like that code was written by a Microsoft employee. Typedefs all over the place. What's wrong with using real types?

Trying to port code for another processor is generally an exercise in frustration. Knowing exactly what the code does, and writing code to accomplish the same goal usually works a lot better that blanket change this to that porting.

he compiler is also gives error for "MS_TIMER".

I'd try a call to "millis", but that's just a guess.

I sense some rubbish in that library, then.

This wrapper will start the timer before the first byte was received."

How can it know when to start the timer? What is the timer for?

What device are you trying to talk to?

You need to change your mindset. You aren't porting "C-Code to Arduino". The "Arduino Syntax" is already C.

Instead you are you porting code for different hardware platform to the Arduino (ATmega) Platform. Your question of "MS_TIMER" is a good example. You need to determine what that means to the original platform and how it is being used in this code BEFORE you can determine how to implement it on the Arduino. You can't simply look for something with a similar name.

Code for microcontrollers tends to be a little less portable because you are programming directly for the hardware.

I am trying to communicate with a RFID reader module.

Then I would simply replace the code that talks over the serial port with the new software serial library assuming you are using an Uno and not a Mega.

My project have five user-defined header file. I have placed them under "arduino-1.0\libraries\RFID". Everything seems to be ok right now.

First, the arduino-1.0\libraries folder is for Arduino-delivered libraries, not user-developed or user-downloaded libraries. You should put your libraries in the right place.

Anyway Arduino IDE gives "error: expected `)' before '*' token" error for this part of code:

What is before the * token? RFID_CALLBACK is. Where is this symbol defined?

typedef HANDLE32    RFID_RADIO_HANDLE;

The Arduino has no idea what a HANDLE32 is, either.

In these tree struct definitions, It gives "error: 'RFID_PACKET_CALLBACK_FUNCTION' does not name a type" error.

And, it is absolutely right to. Where is the symbol RFID_PACKET_CALLBACK_FUNCTION defined? Nowhere in the snippets you posted.