Help in openning files 
Author Message
 Help in openning files


Quote:
> ... My question is how can I open more than 15 files ( the target is 80 files ) ...

Better to change your program.  No operating-system that I know allous 80
open files.


Sun, 11 Jan 1998 03:00:00 GMT  
 Help in openning files

Quote:


>> ... My question is how can I open more than 15 files ( the target is 80 files ) ...

>Better to change your program.  No operating-system that I know allous 80
>open files.

Are you trying to open 15 files one after another

open file a close a
open file b close b

you can open 15 files one at a time one after another here is a copy of some code that i use to
do this with

---------------------------begin code here-----------------------------------------------
CLS
TOP:

' just a neet opening menu that gives you a few choises on what types of files to open

LOCATE 1, 1: PRINT "("; : COLOR 14, 0: PRINT "A"; : COLOR 7, 0: PRINT ") *.TXT FILES"
LOCATE 2, 1: PRINT "("; : COLOR 14, 0: PRINT "B"; : COLOR 7, 0: PRINT ") *.    FILES"
LOCATE 3, 1: PRINT "("; : COLOR 14, 0: PRINT "C"; : COLOR 7, 0: PRINT ") *.*   FILES"
LOCATE 4, 6: PRINT "E"; : COLOR 14, 0: PRINT "X"; : COLOR 7, 0: PRINT "IT"; ""
ANYKEY$ = INKEY$
SELECT CASE ANYKEY$
        CASE IS = ""
                GOTO TOP
        CASE IS = "a", "A"
                SHELL "DIR /A-D /B *.txt >C:\FILTER.DAT" 'this does all *.txt files in a dir
        CASE IS = "B", "b"
                SHELL "DIR /A-D /B *. >C:\FILTER.DAT"    'this does all *. files in a dir
                DOT = 1
        CASE IS = "C", "c"
                SHELL "DIR /A-D /B *.* >C:\FILTER.DAT"   'this does all files in a dir
        CASE IS = "x", "X"
                SYSTEM
                END
        CASE IS = "V", "v"              'this just gives a netat version number :)
                PRINT "FILTER 1.999999"
                GOTO TOP
        CASE IS = "P", "p"              'this is a debugging tool used in my program
                PAUSE = 1
                GOTO TOP
        CASE ELSE
                GOTO TOP
END SELECT
SHELL "DELTREE /Y TEMP"                 'don't worry about this line
CLS
MKDIR "TEMP"                            'or this one too
OPEN "C:\FILTER.DAT" FOR INPUT AS 1     'this is very important this is where
                                        'you get your files names from
WHILE NOT EOF(1)

input #1, file$                         ' gets the first file name
open file$ for input as 2               ' open the file

'large chunk of progran deleted if you need a program that will strip out extemded
'ascii from a file wright me i will send you the rest

'do what you want to do to the file here between the while...wend loop

close 2                                 'closes the file
WEND

-------------------------end code here------------------------------------------------

this section of code will put all the file names in to c:\filter.dat then open c:\filter.dat and
open the files one at a time i hope this works if not at least gave you an idea

Bryce Lindsay



Sun, 11 Jan 1998 03:00:00 GMT  
 Help in openning files

|   Better to change your program.  No operating-system that I know allous
|   80 open files.

SunOS 4.1.3 (at least) allows 256 open files, but you need to set the
ulimit to 256 (the maximum) before you open them all.  unfortunately,
whatever wrote the standard I/O-library was a moron so "forgot" to use
_unsigned_ char in the file descriptor field of the FILE structure, so you
can't use more than 128 files with stdio.  fortunately, this isn't a
problem these days, because we mmap in the files instead of reading them
sequentially, anyway.  of course, you can't do that without virtual memory,
so if you're on an operating-system challenged Intel, consider Linux,
NetBSD, FreeBSD, or HURD, instead.

#<Erik 3015748267>
--
NETSCAPISM /net-'sca-,pi-z*m/ n (1995): habitual diversion of the mind to
    purely imaginative activity or entertainment as an escape from the
    realization that the Internet was built by and for someone else.



Sun, 11 Jan 1998 03:00:00 GMT  
 Help in openning files
: Hi,

: I'm writing a program that need to open about 80 files at the same time. Now,
: the problem is that under DOS, it seems only allow 15 files (handles) to be
: opened at the same time.


David,

The number of files that can be opened depends on the FILES = # -line in the
config.sys. I don't know for sure, but would truning up that number allow
you to open more files in your program ?



Sun, 11 Jan 1998 03:00:00 GMT  
 Help in openning files
[Erik Naggum]

|   SunOS 4.1.3 (at least) allows 256 open files, but you need to set the
|   ulimit to 256 (the maximum) before you open them all.

per process, that is.  for the entire system, it is common to have several
thousand open files available for allocation.

#<Erik 3015763395>
--
NETSCAPISM /net-'sca-,pi-z*m/ n (1995): habitual diversion of the mind to
    purely imaginative activity or entertainment as an escape from the
    realization that the Internet was built by and for someone else.



Sun, 11 Jan 1998 03:00:00 GMT  
 Help in openning files

Quote:
>>No operating-system that I know allous 80 open files.
>SunOS 4.1.3 (at least) allows 256 open files, but you need to set the
>ulimit to 256 (the maximum) before you open them all.  unfortunately,

My Bullet/2 toolkit does 1024 files per process in OS/2, no problem.

--

(FTP) ftp.crl.com /users/co/cornel --- (WWW) ftp://ftp.crl.com/users/co/cornel
BBS/fax: +1-210-684-8065 / Monday-Friday after 5pm / Weekends 24 hours [-0500]
   - Bullet/DOS 1.25 - Bullet/Win 1.25 - Bullet/2 2X - Ruckus/DOS 1.2 -



Sun, 11 Jan 1998 03:00:00 GMT  
 Help in openning files

Quote:


>|   Better to change your program.  No operating-system that I know allous
>|   80 open files.
>SunOS 4.1.3 (at least) allows 256 open files, but you need to set the
>ulimit to 256 (the maximum) before you open them all.

CP/M allowed unlimited open Files.
In theory of course; in praxis it was limited to the number of File's
on your Disk's...
One open file consumed 36 Byte's; so without 'swapping' some Data-Ram
to Disk you would be limited to 1300 File's  filling your RAM to about
48K (of about 60K maximum...)

Quote:
>#<Erik 3015748267>

greetings, Holger


Sun, 11 Jan 1998 03:00:00 GMT  
 Help in openning files

Quote:


>> ... My question is how can I open more than 15 files ( the target is 80 files ) ...

>Better to change your program.  No operating-system that I know allous 80
>open files.

Or to switch to an operating system you don't know of (AIX springs to mind).

Dan
--
Dan Pop
CERN, CN Division

Mail:  CERN - PPE, Bat. 31 R-004, CH-1211 Geneve 23, Switzerland



Mon, 12 Jan 1998 03:00:00 GMT  
 Help in openning files

Quote:



writes
>>> ... My question is how can I open more than 15 files ( the target is 80
files ) ...

>>Better to change your program.  No operating-system that I know allous 80
>>open files.

>Or to switch to an operating system you don't know of (AIX springs to mind).

The Oberon operating system allows an unlimited number of files to be open at
one time -- and it can be hosted on a PC under MS-DOS.  Not-so-interestingly
(or surprisingly), this can be implemented WITHOUT using more than 15
simultaneously open files by a simple little CS concept known as 'least
recently used'.

Sit down and figure it out... if you can open files in assembly, you should be
able to do this.

Taylor Hutt



Mon, 12 Jan 1998 03:00:00 GMT  
 Help in openning files


Quote:
>Hi,

>I'm writing a program that need to open about 80 files at the same time. Now,
>the problem is that under DOS, it seems only allow 15 files (handles) to be
>opened at the same time.

>My question is how can I open more than 15 files ( the target is 80 files )
>in DOS using MicroSoft C 7.0. Is there any library, addons that can allow me to
>do so ? Or how should I write the code for this purpose ?

>If any programmer know how to do so, please drop me an email. If there is some
>library for MSC, please also tell me in which ftp site I can get it. And
>how can I interface it with my program.

In DOS each task has 20 file handles, 5 of which are pre-opened for
stdin etc.  You can increase the number of handles per task using DOS
function 67h to whatever you want (max 255).  Ensure that the FILE= in
the config file is enough for all tasks.  You will now be able to use
the DOS open and create functions.  I am not so sure that the c buffered
i/o library will notice that more handles are available so you may have
to call DOS directly.

Email me if you can't find the interface for DOS function 67h and I will
look it up for you.

--
Paul
-------------------------------------------------------------------------
Paul Overell, T U R N P I K E  Ltd                   tel: +44 1306 747747
Dorking Business Park, DORKING, Surrey, UK. RH4 1HN  fax: +44 1306 747749



Mon, 12 Jan 1998 03:00:00 GMT  
 Help in openning files

Quote:



>>> ... My question is how can I open more than 15 files ( the target is 80 files ) ...

>>Better to change your program.  No operating-system that I know allous 80
>>open files.
>Are you trying to open 15 files one after another

[ SNIP A LARGISH CHUNK OF CODE THAT HAS NOTHING TO DO WITH C ]

Quote:
>this section of code will put all the file names in to c:\filter.dat
>then open c:\filter.dat and open the files one at a time i hope this
>works if not at least gave you an idea
>Bryce Lindsay

What is the relevance of your post? It is not even C, and this *is*
comp.lang.c. Has anyone considered the much simpler suggestions of:

1) Setting ulimit (if under Unix)
2) Setting FILES=100 in CONFIG.SYS under M$-DOG

Which solves the user's problem?

Best regards,
Derick.

--
+-----------------------------------------------------------------------------+
| Derick R. Qua-Gonzalez                                           | ________ |
| Department of High Energy Physics, California State University   | \      / |

|        ``It is better to be hated for what one is,               |   \  /   |
|          than loved for what one is not.'' (A. Gide)             | G  \/ USA|
+------------------------------------------------------------------+----------+
| mQBNAy/qJJMAAAECANBCB543eTUkdG8Mqx6K2cm3WxCVtKY8ZbB9WY6A2Ne4dQi8 | PGP2.6.2 |
| xh7OxjHXP/eXp5BSbmVAihEGd7r+5g/yknko56kABRG0MERKUiBRdWEtR29uemFs |  Public  |
| ZXogPGRxdWFAUHJvbWV0aGV1cy5FYXJ0aGxpbmsuTmV0Pg==                 | KeyBlock |
| =70DW                                                            | 06.20.95 |
+------------------------------------------------------------------+----------+



Mon, 12 Jan 1998 03:00:00 GMT  
 Help in openning files

Quote:

>one time -- and it can be hosted on a PC under MS-DOS.  Not-so-interestingly
>(or surprisingly), this can be implemented WITHOUT using more than 15
>simultaneously open files by a simple little CS concept known as 'least
>recently used'.

The problem is that the 'open' is a very intensive operation, not something
that you want to do more than you have to.  Kludging file opens by closing
others, only to reopen them when needed, is a verrrrry slow process,
especially, and this is the whole point of having lots of handles available,
if you really need to access, say, 200, 300, or 1000 files in the same
operation.  Having to open/close for each access would turn the operation
from milliseconds to several seconds, per op.  Disk I/O is slow enough as
it is; no need to slow it down 100 fold.
--

(FTP) ftp.crl.com /users/co/cornel --- (WWW) ftp://ftp.crl.com/users/co/cornel
BBS/fax: +1-210-684-8065 / Monday-Friday after 5pm / Weekends 24 hours [-0500]
   - Bullet/DOS 1.25 - Bullet/Win 1.25 - Bullet/2 2X - Ruckus/DOS 1.2 -


Mon, 12 Jan 1998 03:00:00 GMT  
 Help in openning files

Quote:


> >Better to change your program.  No operating-system that I know allous 80
> >open files.

> Or to switch to an operating system you don't know of (AIX springs to mind).

I'm beginning to wonder what operating system he *does* know about, since
even MS-DOS permits 255 simultaneous open files, and up to 65,535 file
handles per process.

Sheesh.  Doesn't anybody read manuals any more?

---
Glen Blankenship



Mon, 12 Jan 1998 03:00:00 GMT  
 Help in openning files

D> My question is how can I open more than 15 files ( the target is 80 files )
D> in DOS using MicroSoft C 7.0. Is there any library, addons that can allow me to
D> do so ? Or how should I write the code for this purpose ?

You probably must use DOS calls directly, not fopen() or even open().
It works after extending the task file limit.



Tue, 13 Jan 1998 03:00:00 GMT  
 Help in openning files


Quote:
>[ SNIP A LARGISH CHUNK OF CODE THAT HAS NOTHING TO DO WITH C ]

>What is the relevance of your post? It is not even C, and this *is*
>comp.lang.c. Has anyone considered the much simpler suggestions of:

>1) Setting ulimit (if under Unix)
>2) Setting FILES=100 in CONFIG.SYS under M$-DOG

>Which solves the user's problem?

I'm reading this in comp.lang.misc; the post is going to far too many groups
(most of which I've pruned).

I think the original poster had already upped his config.sys FILES setting....

--



Tue, 13 Jan 1998 03:00:00 GMT  
 
 [ 27 post ]  Go to page: [1] [2]

 Relevant Pages 

1. Problem of Openning a File !!!

2. openning a print "file"

3. Openning a Document File with multiple views

4. Problem of Openning a File !!!

5. Openning Office Files

6. Openning MS Word doc in C#....

7. openning two windows for comm.

8. Very slow openning of CRecordset

9. Openning a Stored Procedures with CRecordset

10. Openning Access 2000 database with DAO

11. Openning Access forms

12. VC60 hangs on openning some workspaces

 

 
Powered by phpBB® Forum Software