Text File Check #198
-
I'm trying to read in a text file (.json) and I want to do a simple check that the 1st 11 bytes match a standard pattern before importing it, as a level of security for not crashing everything in a screaming heap. This is the code I tried, but it doesn't work (the :read(11)) is from io.read, which doesn't seem to be supported in ctrlr - it was a long shot). Anyone know how I can do this check, or do I need to loadFileAsString to a variable and then check the variable?
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
Are you trying to read a sysex or a text file?
|
Beta Was this translation helpful? Give feedback.
-
Are you worried whether the string "sysex" is in the message or just using that to make sure the file is from your program? |
Beta Was this translation helpful? Give feedback.
Are you trying to read a sysex or a text file?
If sysex then use this code: