Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Curious question only. 2

Status
Not open for further replies.

MiggyD

Programmer
May 23, 2000
1,152
US
In the QB help files (I have v 4.5), it indicates (moreso...it implies) that the number of data files you can have opened at any one time is 255.

However, I've only been able to access 15 simultaniously. Example follows:

FOR FileNum=1 TO 30
[tab]MyFile$="trash" + Ltrim$(Str$(FileNum))+".txt"
[tab]OPEN MyFile$ for output as FileNum
[tab]PRINT #FileNum, "This is file #";str$(FileNum)
next FileNum

Any ideas why? Could it be a typo in the Help file?

I have not yet looked in the MS Knowledge Base, I'm hoping someone here has already found the answer to this curiosity question.

Thanks in advance. -- MiggyD

PS--I've even changed the FILES setting in autoexec.bat but to no avail. [sig]<p> <br><a href=mailto: > </a><br><a href= > </a><br>English is too hard to learn, the vowles change too much like come/home, comb/tomb, book/school, high/bye/sty, etc., etc. So should I say Geez or Sheez or Cheeze? hehe.[/sig]
 
What about in the config.sys? [sig]<p>David Paulson<br><a href=mailto: > </a><br><a href= > </a><br> [/sig]
 
Oops! My mistake, I did mean to say the config.sys file. Have you tried to access more than 15 files simultianeously?

Interesting isn't it? I'looking through the KB now, hopefuly there's an answer to this riddle. [sig]<p> <br><a href=mailto: > </a><br><a href= > </a><br>English is too hard to learn, the vowles change too much like come/home, comb/tomb, book/school, high/bye/sty, etc., etc. So should I say Geez or Sheez or Cheeze? hehe.[/sig]
 
You know, MiggyD, I thought I could provide an answer this morning. Thought I'd be a wiseguy and whip up a solution using the DOS services.

The only problem is that the solution quit after 7 files were open.

Here's the code, if you want to play with it. Maybe somebody can spot my error....
[tt]
' $DYNAMIC
DEFINT A-Z
TYPE RegTypeX
ax AS INTEGER
BX AS INTEGER
CX AS INTEGER
DX AS INTEGER
BP AS INTEGER
SI AS INTEGER
DI AS INTEGER
FLAGS AS INTEGER
DS AS LONG
ES AS INTEGER
END TYPE
DIM Inregs AS RegTypeX, Outregs AS RegTypeX

REDIM OpenFiles(1 TO 30)

FOR FileNum = 1 TO 30
MyFile$ = &quot;trash&quot; + LTRIM$(STR$(FileNum)) + &quot;.txt&quot; + CHR$(0)
Inregs.ax = &H3C00
Inregs.CX = &H20
Inregs.DS = VARSEG(MyFile$)
Inregs.DX = SADD(MyFile$)
CALL InterruptX(&H21, Inregs, Outregs) 'Create empty file
hFile = Outregs.ax
PRINT &quot;Creating:&quot;; hFile
OpenFiles(FileNum) = hFile

Inregs.ax = &H3D01 '10=read/write
Inregs.DS = VARSEG(MyFile$)
Inregs.DX = SADD(MyFile$)
CALL InterruptX(&H21, Inregs, Outregs) 'Open file
PRINT &quot;Opening:&quot;; hFile

Inregs.ax = &H4000
Inregs.BX = hFile

Text$ = &quot;This is file #&quot; + STR$(FileNum)
Inregs.CX = LEN(Text$)

Inregs.DS = VARSEG(Text$)
Inregs.DX = SADD(Text$)
CALL InterruptX(&H21, Inregs, Outregs) 'Write to file
NEXT

FOR FileNum = 1 TO 30
hFile = OpenFiles(FileNum)
Inregs.ax = &H3E00
Inregs.BX = hFile
CALL InterruptX(&H21, Inregs, Outregs) 'Close each file
NEXT
[/tt]

[sig]<p> <br><a href=mailto: > </a><br><a href= plain black box</a><br>"Suffice it to say that adding disk drives and a disk operating system to a personal microcomputer is guaranteed to increase its power dramatically."<br>
<u><b>CP/M and the Personal Computer</u></b>[/sig]
 
I have tried you code. Mine also quits at 15. Dug out my book, blew off dust. All I could find is that the record number could be between 1 and 255, not how many files you could open at once. I don't know what could restrict this.
Tried code in VB6. Program pukes at 512. Sorry I could be of no help.
[sig]<p>David Paulson<br><a href=mailto: > </a><br><a href= > </a><br> [/sig]
 
I've only gotten about one quarter of the way down the KB without much success either.

As I had originally posted &quot;curiosity&quot; is what drives me to this question.

As for the file number response from dpaulson, I saw that in HELP>CONTENT>LIMITATIONS. (see screen shot below) and as I had mentioned before it seems to imply up to 255.

I guess it is statement that may be understood two different ways.

Thanks Alt255 and dpaulson for at least trying.


[tt] File Edit View Search Run Debug Calls Options Help
+------------------ HELP: Limits - Procedures and Files --------------¦+
¦ Limits to QuickBASIC Files and Procedures Contents Index
¦------------------------------------------------------------------------
¦Limits to QuickBASIC - Procedures and Files
¦ Maximum Minimum
¦Procedure size (interpreted) 65,535 bytes (64 K) 0
¦Number of arguments passed 60 interpreted 0
¦Nesting of include files 5 levels 0
¦Module size (compiled) 65,535 bytes (64 K) 0
[red]¦Data file numbers 255 1[/red]
¦Data file record number 2,147,483,647 1
¦Data file record size (bytes) 32,767 bytes (32 K) 1 byte
¦Data file size Available disk space 0
¦Path names 127 characters 1 char
¦Error message numbers 255 1
+------------------------------- Untitled ----------------------------¦+[/tt] [sig]<p> <br><a href=mailto: > </a><br><a href= > </a><br>English is too hard to learn, the vowles change too much like come/home, comb/tomb, book/school, high/bye/sty, etc., etc. So should I say Geez or Sheez or Cheeze? hehe.[/sig]
 
PS--dpaulson thanks for the info on VB6. I only have VB4, but it's a good tip none-the-less that I'll have to keep in mind for when VB6 becomes more affordable.

PPS--Alt255, I'm sorry to have you rack your brains on this innocent question. But thanks for trying an alternative way that I hadn't thought of.

See ya 'round guys! and Thanks again. [sig]<p> <br><a href=mailto: > </a><br><a href= > </a><br>English is too hard to learn, the vowles change too much like come/home, comb/tomb, book/school, high/bye/sty, etc., etc. So should I say Geez or Sheez or Cheeze? hehe.[/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top