Differences in the SD Card commands bug


#1

In VCS C++ professional, in the directory of commands, it lists “Brain.SDcard.saveFile” typing this in results in an error


no member named "Brain.SDcard.saveFile" in vex::brain::sdcard 

but when you type in “Brain.SDcard.savefile” (no capital f) there is no error. I believe this is in error.

Onto my second point, is it at all possible to save a 2 dimensional array say


int example [10][10] 

to a file on the SD card? I understand how to use a one dimensional array, but cant figure out how to use something like this.


Brain.SDcard.saveFile("filename.c",example,100);

The error I get is

  "cannot initialize a parameter of type 'uint8_t *' (aka 'unsigned char *') with an lvalue of type 'int [10][10]' 
 Brain.SDcard.savefile("filename.c",example,100); "

#2

Here’s a screenshot of what the side directory looks like @jpearman
Capture.PNG


#3

yes, it’s a mismatch between the documentation and actual method name. All the VCS drawer info was pulled from the sdk header files, so we have an error between this


@block_sig{saveFile("filename.txt", buffer, 100);}

and this


int32_t savefile(const char *name, uint8_t *buffer, int32_t len );

you will need to typecast the int array and also set the length to the byte length rather than the number of elements.


Brain.SDcard.savefile( "filename.c", (uint8_t *)example, sizeof(example) );


#4

Something tells me someone is writing a rerun… Anyway, if the values you are saving whatever they may be aren’t too high, you could just make the 2d array consist of only 8 bit integers, but that would limit the maximum value you could store drastically (I’m having the same problem because I’m trying to save a 2d array as well but unfortunately my values are larger than 8 bits) If the array was an 8 bit array the function would accept it because it translates to the same thing as the characters it wants. Now, the main problem with this is that negative values cannot be recorded because it is an unsigned integer, so if you, ya know, for some odd reason wanted to record your joystick, the negative value couldn’t just be stuffed into the array.


#5

Uh, add 100 to the value when saved to the array, subtract 100 when you read the array?


#6

Well, yes, obviously you can encode the values. I just figured that was a bit obvious just wanted to point out that you cant just stuff the regular value in