Code: Select all
void cmucamCameraContrast(out port TXD, in port RXD, char buffer[], int contrast){
char n[3];
char r[10];
n = toString(contrast);
appendString("CC ", n, r);
sendCommand(TXD, r);
getResult(RXD, buffer);
}
-John
Code: Select all
void cmucamCameraContrast(out port TXD, in port RXD, char buffer[], int contrast){
char n[3];
char r[10];
n = toString(contrast);
appendString("CC ", n, r);
sendCommand(TXD, r);
getResult(RXD, buffer);
}
As with C, you can't assign one array to another using '=' and you can't return arrays from functions.JohnRobert wrote:Title says it all! I've been getting this error (invalid lvalue in assignment)
Code: Select all
void cmucamCameraContrast(out port TXD, in port RXD, char buffer[], int contrast){
char n[3];
char r[10];
toString(contrast, n);
appendString("CC ", n, r);
sendCommand(TXD, r);
getResult(RXD, buffer);
}
Code: Select all
void cmucamCameraContrast(out port TXD, in port RXD, char buffer[], int contrast){
char n[5];
char r[10];
toString(n, contrast);
appendString("CC ", n, r);
sendCommand(TXD, r);
getResult(RXD, buffer);
}
Code: Select all
void cmucamCameraContrast(out port TXD, in port RXD, char buffer[], int contrast){
char n[5];
char r[10];
n = "1234";
appendString("CC ", n, r);
sendCommand(TXD, r);
getResult(RXD, buffer);
}
This is rejected for the same reason your original program is rejected - it is an assignment where the left hand side is an array. Note you can use '=' to initialize a declaration, i.e.JohnRobert wrote:But I get the same lvalue error on the line "n='1234';", why is this so?
Code: Select all
int n[5] = "1234";
Code: Select all
int n[5];
n = "1234";