TIP: Click on subject to list as thread! ANSI
echo: aust_c_here
to: All
from: Ron T Lewis
date: 1995-09-22 23:21:14
subject: File IO Error

Hello All,

          I hope someone can help me with this rather unusual

          problem:-



I'm loading a picture file into a ModeX screen and using XLib for the

graphic primitives. However my problem appears to lie in the Dos file

system or at least my poor understanding of it.



The following function works fine on the **first** call for any

particular pic file. IE:- I can load file a, b or c and it runs

perfect until I want to load a or b for the second time.



unsigned far char * buff;  // 64k Screen Buffer



int load_pbm(char * fname, char page)

{

FILE *handle;

int test = -2;

cls(page); // clear screen for testing purpose only

if((handle=fopen(fname,"rb"))==NULL) return(test);

test = fread((far char *) buff,64002,1,handle);

// Falls over here on 2nd call for same file name.. test == 0

fclose(handle);

if(test) x_put_pbm(0, 0, page, buff);

return(test);

}



On the second call it opens the file fine but test returns as zero and

it appears the buffer is loaded with zeros??  (unsure of this)



It appears to expect to find the file in the file buffer and not on

the HD as the light doesn't operate and the speed is as if it's

coming from Ram.



I can load different files without a problem as it ONLY seems to

hiccup when I want the same file as 1-4 files back. If I load the

SAME file ie:- load file "a.pbm" (it loads from disc) and then I load

"a.pbm" again, it loads nothing and seems to come from Ram (not the HD)?.



I'm not running any external disk cache or any funny kludges.



Are there any traps in Dos for the unwary ex.Amigan??



My files and buffers are set to 30 in config.sys.



Any help will be appreciated.. :-)



(OH! Well! Life's like that Sumtimes!) Regards Ron T Lewis

 InterNet Address (ron.t.lewis{at}softtech.brisnet.org.au)

  FidoNet Address  (Ron T Lewis 3:640/201)                       



--- Blue Wave/Max v2.20 [NR]

* Origin: Soft-Tech, Qld, Australia +61-7-869-2666 (3:640/201)
SEEN-BY: 50/99 620/243 623/630 640/101 201 206 215 216 217 222 238 247 281
SEEN-BY: 640/299 301 302 305 375 390 452 523 531 820 821 822 823 890 937
SEEN-BY: 690/660 711/401 409 410 430 510 807 808 809 932 934 712/515 713/888
SEEN-BY: 714/906 800/1 7877/2809
@PATH: 640/201 820 711/409 808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

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™.