1. RESPCODE : Bload
[ BLOAD ]
Greame posted
function bload(sequence path)
integer fn,c
sequence r
r={}
fn=open(path,"rb")
c=getc(fn) -- PROBLEM! What if the open failed?
while c!=-1 do
r=r&c
c=getc(fn)
end while
return r
end function
-- This should fix the problem of open failure.
----- *Untested Code* -----
function bload(sequence path)
integer fn,c
sequence r
r = {}
fn = open(path,"rb")
c = fn
while c != -1 do
c = getc(fn)
r = r&c
end while
return r
end function
-----
Sincerely,
Mathew Hounsell
Mat.Hounsell at Mailexcite.Com
Free web-based email, Forever, From anywhere!
http://www.mailexcite.com
2. Re: RESPCODE : Bload
- Posted by "Graeme." <hmi at POWERUP.COM.AU>
Jun 12, 1998
-
Last edited Jun 13, 1998
At 02:01 AM 6/12/98 -0700, you wrote:
>[ BLOAD ]
>Greame posted
>function bload(sequence path)
>integer fn,c
>sequence r
>
> r={}
> fn=open(path,"rb")
> c=getc(fn) -- PROBLEM! What if the open failed?
> while c!=-1 do
> r=r&c
> c=getc(fn)
> end while
> return r
> end function
>
>-- This should fix the problem of open failure.
>----- *Untested Code* -----
>function bload(sequence path)
>integer fn,c
>sequence r
>
> r = {}
> fn = open(path,"rb")
> c = fn
> while c != -1 do
> c = getc(fn)
> r = r&c
> end while
> return r
>end function
I just typed it into Eudora to
illustrate the principle of loading
data, but that's an elegant solution
for the open fail case. The only
problem with it is that it adds and
extra byte to the file every time
you load it.
Graeme.
----------------------------------------------------