View Single Post
Old 06-26-2019, 01:50 AM   #19
Tale
Human being with feelings
 
Tale's Avatar
 
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,143
Default

Something like this should probably work:

Code:
undef = 0;
strcpy(undef, "[Undef]");
memset(map, undef, 128);

handle = file_open(slider30);
handle >= 0 ? (
  file_text(handle) ? (
    str = undef + 1;
    while(
      file_string(handle, #line);
      file_avail(handle) ? (
        // You could probably deal with line-endings more efficiently...
        (match("%d %s\r\n", #line, note, str) ||
        match("%d %s\n", #line, note, str)) &&
        note >= 0 && note < 128 ? (
          map[note] = str;
          str += 1;
        );
        1; // while
      );
    );
  );
  file_close(handle);
);
Tale is online now   Reply With Quote