TIP: Click on subject to list as thread! ANSI
echo: power_bas
to: ALL
from: JEROEN VAN RIJN
date: 1998-03-22 19:29:00
subject: Re: Need help with binary

From: Jeroen van Rijn 
Subject: Re: Need help with binary file question...
 
PWRBASC wrote:
>
> I am new to binary files. I am trying to read a file which is over 15 meg 
n
> size. Each record is 404 bytes long. When I read 82 records into the file, 

> get an error #15 (string length too long) using this command "GET$ 1, 
Position,
> A$"
> When A$ exceeds the 32750 limit, then the error pops up. Is there some way 
to
> reset A$ back to 0 and read another 32750 bytes into file from the point 
where
> the first seek ended.
 
The problem is I think that what you describe as Position in the GET
statement is
actually the number of bytes to read, so thus you are exceeding the
greatest number
of bytes you can read at once, which is 32k (32767).
 
The next code would work properly:
 
OPTION BINARY BASE 0	'First byte in file is at pos 0
OPEN "FILENAME.EXT" FOR BINARY AS #1
SEEK #1, 0		'Seek puts the read pointer at a certain position
DO
  IF EOF(1) THEN EXIT DO	'When end of file exit loop
  GET$ #1, 404, A$		'Reads next 404 bytes and puts them in A$
  'put code that manipulates
  'data here
  PRINT A$			'display read info, or something else...
LOOP
 
To read a certain record use this:
 
SEEK #1, (Record%-1)*404	'Puts the read pointer at record Record%
GET$ #1, 404, A$
 
> Any help is greatly appreciated!
Hope this helps....
 
Kindest regards,
  Jeroen van Rijn,
  Network supervisor,
  Rembrandt Packaging
 
> Gary Stout   pwrbasc@aol.com
 
*** QwkNews (tm) v2.1
 * [TN71] Toast House Import
--- GEcho 1.20/Pro
---------------
* Origin: Toast House Remote (1:100/561)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.