Path/File Access Error again ... and I reckon I know what's causing itby (Login QootyKev)I put this up while back, here it is again.
Im getting File/Path Access Errors whenever there is some intensive recurring file creation/closure/overwriting. I can swear that what's happening is that my PC is soooo slow that a backlog of requests from QBasic is building up when this stuff runs. make file put stuff in file close file open file read data from file close file copy filename to another file name go back and make next file ^^^^^^ i think it tries to open that file before the PC has acted on QB's request for it to make and close the file in the first place! I seem to be able to fix this stuff with redundant file closure commands, and pauses to allow the computer to catch up. EG : CLOSE #3 FOR CloseFrickenFile% = 1 TO 10000: NEXT CloseFrickenFile% CLOSE #3 OPEN "formtrak.tmp" FOR OUTPUT AS #3 It still did it, but much less commonly, so I presumed I was on the right track. So I did this instead : CLOSE #3 FOR CloseFrickenFile% = 1 TO 10000: NEXT CloseFrickenFile% CLOSE #3 FF$ = "Form" FOR T% = 1 TO 4 FF% = INT(RND(1) * 10) FF$ = FF$ + LTRIM$(RTRIM$(STR$(FF%))) NEXT T% FF$ = FF$ + ".tmp" OPEN FF$ FOR OUTPUT AS #3 'OPEN "formtrak.tmp" FOR OUTPUT AS #3 FormInstancesFound% = 0 Well its all well and good to use that workaround, but its hardly robust. Anyone else hit this trouble? Known what to do? |
| Response Title | Author and Date |
| *Can you give more details on how you are "copying" the file? | on Jul 19 |
| SHELL "copy filename.ext newname.ext" | on Jul 19 |
| Try Name "myfile.tmp" AS "newfile.txt" instead.: | on Jul 19 |
| Three ideas, two of them yours :) | on Jul 21 |
| Don't promise them anything... | on Jul 21 |
| Thanks for the heads up! | on Jul 21 |
| Here's the clearest example so far | on Jul 22 |
| Your code works OK on my XP, but I'm running a slightly older version of QB64. | on Jul 22 |