I think there is a limit to how much is saved to a file.
If I make the variable "map" smaller, it works fine.
Code: Select all
LocationType map[]={{1,1},{2,2},{3,3},{1,1},{2,2},{3,3},{1,1},{2,2},{3,3},{1,1},{2,2},{3,3},{1,1},{2,2},{3,3},{1,1},{2,2},{3,3},{1,1},{2,2},{3,3},{1,1},{2,2},{3,3},{1,1},{2,2},{3,3},{1,1},{2,2},{3,3},{1,1},{2,2},{3,3},{1,1},{2,2},{3,3},{1,1},{2,2},{3,3},{1,1},{2,2},{3,3},{1,1},{2,2},{3,3},{1,1},{2,2},{3,3},{1,1},{2,2},{3,3},{1,1},{2,2},{3,3},{1,1},{2,2},{3,3},{1,1},{2,2},{3,3},{1,1},{2,2},{3,3},{1,1},{2,2},{3,3},{1,1},{2,2},{3,3},{1,1},{2,2},{3,3},{1,1},{2,2},{3,3},{1,1},{2,2},{3,3},{1,1},{2,2},{3,3},{1,1},{2,2},{3,3},{1,1},{2,2},{3,3},{1,1},{2,2},{3,3},{1,1},{2,2},{3,3},{1,1},{2,2},{3,3},{1,1},{2,2},{3,3},{1,1},{2,2},{3,3},{1,1},{2,2},{3,3},{1,1},{2,2},{3,3},{1,1},{2,2},{3,3},{1,1},{2,2},{3,3},{1,1},{2,2},{3,3}};
int A1[];
int A2[];
int fs=2000;
long handle=0;
long handle2=0;
task main()
{
while(1)
{
if(ButtonPressed(BTNLEFT,0))
{
// string text=ByteArrayToStr(map);
//TextOut(0,0,text);
// Wait(5000);
ClearScreen();
long Arrlen=ArrayLen(map);
ArrayInit(A1,0,Arrlen);
ArrayInit(A2,0,Arrlen);
for(long c=0; c < Arrlen;c++)
{
A1[c]=map[c].X;
}
PlayToneEx(500,30,1,0);
for(long c=0; c < Arrlen;c++)
{
A2[c]=map[c].Y;
}
DeleteFile("test.tst");
CreateFile("test.tst",fs,handle);
Write(handle,A1);
CloseFile(handle);
DeleteFile("test2.tst");
CreateFile("test2.tst",fs,handle2);
Write(handle2,A2);
CloseFile(handle2);
PlayToneEx(400,30,1,0);
}
if(ButtonPressed(BTNRIGHT,0))
{
//string text2;
OpenFileRead("test.tst",fs,handle);
Read(handle,A1);
CloseFile(handle);
OpenFileRead("test2.tst",fs,handle2);
Read(handle2,A2);
CloseFile(handle);
long Arrlen=ArrayLen(A1);
for(long c=0; c < Arrlen;c++)
{
map[c].X=A1[c];
}
for(long c=0; c < Arrlen;c++)
{
map[c].Y=A2[c];
}
//StrToByteArray(text2,map);
NumOut(0,0,Arrlen);
Wait(1000);
ClearScreen();
}
}
}