checking for errors

One interesting aspect of the File Access block is that it may not be able to perform the task you’ve given it. For example, the block can’t read from a file that doesn’t exist, and it can’t write to a file if the NXT’s memory is full. The block’s Error data plug (shown in Figure 15-9) allows you to check for these kinds of situations. The data plug reports a logic value, namely, true if there was an error and false if the operation was successful.

The File Access block’s Error data plug

Figure 15-9. The File Access block’s Error data plug

Any File Access block can have an error. When designing your program, you need to decide whether you should add code to check for ...

Get The Art of LEGO MINDSTORMS NXT-G Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.