bm getptr

From Archaic Pixels
Jump to: navigation, search

PAGE RECOVERY

original documentation bm_getptr int ptr char name ;      3 03 useful for browsing through the list of files in bram use \'bram_startptr\' for the first iteration and it will return the name of this entry and the next pointer in the list to use for next iteration when the return value is 0 there is no entry at the current location ie don\'t expect a name to be returned and no subsequent entry bm_getptr bm_getptr bm_getptr prototypes bm_getptr int ptr char name ; arguments ptr a pointer to the start of the next file see below name returns the name of the next file in backup ram returns numeric true or false description this function function\'s primary purpose is to allow browsing through the list of files in the backup ram when first used set ptr to bram_startptr and the function function\'s arguments will return the name of the first entry plus a pointer to the next entry in the backup ram when the function function\'s return value is 0 there are no more entries in the backup ram complete example #include huc h main char namebuf 13 ; for bram filenames int nextptr; pointer to the next filename in bram int line_cnt; for displaying the results if bm_check check to see if bram is available on this system put_string backup ram not available 0 0 ; give an error message while 1 vsync ; infinite loop effectively stops the program namebuf 12 0; the last char in the namebuffer has to be an absolute 0 nextptr bram_startptr; sets up the first pointer line_cnt 2; first result will be displayed on character line 5 while nextptr bm_getptr nextptr namebuf get the next filename put_string &namebuf 2 3 line_cnt ; display the filename put_number namebuf 0 1 0 line_cnt ; display the first value of the two-byte id put_number namebuf 1 1 1 line_cnt ; display the second value of the two-byte id put_number bm_sizeof namebuf 4 15 line_cnt ; get the size of the file and display it line_cnt ; increment the char line counter ')