accessing_20huge_20files
Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| accessing_20huge_20files [2018/03/31 13:19] – external edit 127.0.0.1 | accessing_20huge_20files [2024/01/05 00:22] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 2: | Line 2: | ||
| //by Richard Russell, October 2007//\\ \\ Most of the //BBC BASIC for Windows// file-handling statements and functions are fully compatible with files in excess of 2 Gbytes (2^31 bytes) in length. You can successfully open (using **OPENIN** or **OPENUP**) files of any length, and files created with **OPENOUT** can exceed 2 Gbytes in length if you write enough data to them! Sequential reads (using **INPUT#**, **BGET#** and **GET$#**) and writes (using **PRINT#** or **BPUT#**) will work correctly whatever the file size, even when crossing the 2 Gbytes ' | //by Richard Russell, October 2007//\\ \\ Most of the //BBC BASIC for Windows// file-handling statements and functions are fully compatible with files in excess of 2 Gbytes (2^31 bytes) in length. You can successfully open (using **OPENIN** or **OPENUP**) files of any length, and files created with **OPENOUT** can exceed 2 Gbytes in length if you write enough data to them! Sequential reads (using **INPUT#**, **BGET#** and **GET$#**) and writes (using **PRINT#** or **BPUT#**) will work correctly whatever the file size, even when crossing the 2 Gbytes ' | ||
| + | <code bb4w> | ||
| DEF FNext(F%) | DEF FNext(F%) | ||
| LOCAL H%, L% | LOCAL H%, L% | ||
| SYS " | SYS " | ||
| = H% * 2^32 + FNuint(L%) | = H% * 2^32 + FNuint(L%) | ||
| + | </ | ||
| Note that this function may //not// return the correct value while you are writing to the file; it should normally be used only when the file has been opened for reading.\\ \\ Here is the replacement for **PTR#**:\\ \\ | Note that this function may //not// return the correct value while you are writing to the file; it should normally be used only when the file has been opened for reading.\\ \\ Here is the replacement for **PTR#**:\\ \\ | ||
| + | <code bb4w> | ||
| DEF PROCptr(F%, p) | DEF PROCptr(F%, p) | ||
| LOCAL H%, L% | LOCAL H%, L% | ||
| Line 14: | Line 17: | ||
| SYS " | SYS " | ||
| ENDPROC | ENDPROC | ||
| + | </ | ||
| It is not straightforward to //read// the file pointer (beyond 2 Gbytes) or to //write// the file's length (in excess of 2 Gbytes) so routines to do that are not provided. It will normally be possible to avoid these operations.\\ \\ The **FNuint** and **FNintu** functions are listed in the article [[/ | It is not straightforward to //read// the file pointer (beyond 2 Gbytes) or to //write// the file's length (in excess of 2 Gbytes) so routines to do that are not provided. It will normally be possible to avoid these operations.\\ \\ The **FNuint** and **FNintu** functions are listed in the article [[/ | ||
| + | <code bb4w> | ||
| DEF FNuint(N%) = (N% >>> | DEF FNuint(N%) = (N% >>> | ||
| + | </ | ||
| + | <code bb4w> | ||
| DEF FNintu(N) = ((N / 2) << 1) - (INT(N / 2) <> N / 2) | DEF FNintu(N) = ((N / 2) << 1) - (INT(N / 2) <> N / 2) | ||
| + | </ | ||
accessing_20huge_20files.1522502343.txt.gz · Last modified: 2024/01/05 00:18 (external edit)