I have a strange problem with NXC. I try to receive a message from android phone and convert the string to a int value. The problem is it's always 0 Thats just a test programm. so its very strange^^
// MASTER
#define INBOX 0
string tmps1 = "";
string tmps2 = "";
int size;
char ret;
byte tmpi;
bool btn = false;
string msg;
long number;
int countMSG = 0;
int sudoku[9][9];
task main ()
{
SetSensorTouch(IN_3);
SetSensorMode(IN_3, SENSOR_MODE_BOOL);
TextOut (0 , LCD_LINE1 ," Master Receiving ",true );
while (btn == 0)
{
if(ReceiveMessage(INBOX ,true , msg) == NO_ERR)
{
TextOut (0, LCD_LINE3 ,msg, false);
break;
}
Wait(250);
btn = Sensor(IN_3);
}
for(int i = 0; i < 9; i++)
{
tmps1 = SubStr(msg, i, 1);
sudoku[i][0] = StrToNum(strcat(tmps1, "\n"));
TextOut(i*6, LCD_LINE4, tmps1, false);
NumOut(i*6, LCD_LINE5, sudoku[i][0], false);
Wait(1000);
}
Wait(2500);
}
sudoku[9][9] is the problem. there are no 2d arrays in nxc :) i replaced it with
int sudoku[81];
now it works fine!