How does one ignore a void value?

Hey there everybody,
I've been working with the parallax rfid reader/writer I just got :slight_smile: it's super awesome, and I can read data fine, but now I want to try to write it. I decided to write a function to do so (hooray for me!) but I can't get it to work - the error I keep getting is as follows:

rfid.cpp: In function 'void do_rfid_write(char*)':
rfid:125: error: void value not ignored as it ought to be
rfid:128: error: void value not ignored as it ought to be

Here's the code for the write function, and I can include the rest of the code if anyone's interested. How can I test to see if something is void, and then ignore it if so?

void do_rfid_write(char indata[]){
for(int i = 0; i < sizeof(indata)/sizeof(char) && i < maxAddress*4; i++){
sendWriteCommand(i/4); // this is because we can store 4 chars (or bytes) per address

while(!mySerial.available()){
}

statusCode = mySerial.print(indata*); // <- This is line 125, where it fails first*

  • while(statusCode != ERR_OK){*
  • sendWriteCommand(i);*
    _ statusCode = mySerial.print(indata*); // <- This is where it fails second*_
    * }*
    _ Serial.print("wrote address ");
    Serial.println(i);
    * }*
    Serial.println("Finished Write");_

    }
    [/quote]
 statusCode = mySerial.print(indata[i]);

mySerial.print() does not return a value. You can't assign the return code from a function that does not return a value to a variable.

    while(statusCode != ERR_OK){
      sendWriteCommand(i);
      statusCode = mySerial.print(indata[i]); // <- This is where it fails second
    }

This makes no sense. Since mySerial.print() does not return a value, the value that it (doesn't) return can not possibly be ERR_OK. Or, anything else for that matter.

To answer your original question, one "ignores" nothing by not trying to save it.

Ah. Yeah, that would be the problem. Thanks for the quick (and correct) response! It's nice to get a fresh pair of eyes on a problem :slight_smile: