maybe another NXC bug now when using ArrayInit and ArrayBuild for risizing arrays of string -
the program blocks completely,
the BCC program window freezes,
the NXT screen shows "testprogram running"
the NXT is clicking (like if in SAMBA mode):
Code: Select all
// Array Resize
#define ArrRze(&_array_[], _temp_[], _newsize_) { \
int _oldlen_ = ArrayLen(_array_); \
if(_newsize_ > _oldlen_) { \
int _diffsize_ = _newsize_ - _oldlen_; \
ArrayInit (_temp_, 0, _diffsize_ ); \
ArrayBuild(_array_, _array_, _temp_); \
} \
else \
if(_newsize_ < _oldlen_) { \
ArraySubset(_array_, _array_, 0, _newsize_); \
} \
}
#define ArrayResize(a,b) ArrRze(a,a,b)
string array1[2];
task main()
{
array1[0] = "ok1";
array1[1] = "ok2";
ArrayResize(array1, 4); //
TextOut(0, 48, array1[0]); // ok1
TextOut(0, 40, array1[1]); // ok2
TextOut(0, 32, array1[2]); // ""
TextOut(0, 24, array1[3]); // ""
Wait(10000);
}