home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!sunic!aun.uninett.no!nuug!falcon!lfosdal
- From: lfosdal@falcon.no (Lars Fosdal)
- Newsgroups: comp.lang.pascal
- Subject: Streams mixed with Files - FileMode problems
- Message-ID: <mw2RXB4w165w@falcon.no>
- Date: Fri, 22 Jan 93 14:01:09 MET
- Organization: Falcon Information Services AS, Oslo, Norway
- Lines: 42
-
- Problem: Streams mixed with files in BP7.0 (under Windows).
-
- The app uses several external files (data/indexes, etc.), of which some
- are binary files, and others are streams.
-
- Scenario:
- My app first stores some data on a stream (TBufStream, mode stCreate).
- If I then try to open another file with assign/reset/blockread, using
- filemode ReadOnly + DenyNone, I get a "can't open for output" error
- message. If I retry, it works (!), ie the file is opened for read.
-
- Pseudocode:
-
- VAR
- Stream : TBufStream;
- Data : MyData;
- fil : File;
- BEGIN
- Stream.Init(stCreate);
- Data.Store(Stream);
- Stream.Done;
-
- oldmode:=filemode;
- filemode:=ReadOnly + denyNone; {$40}
- Retry:
- Assign(File
- Reset(Fil,1); -> Gives File not open for output (RTE:105)
- the first time
- IF (IOresult<>0)
- THEN Retry
- .
- :
- filemode:=oldmode;
-
- Clues, anyone ?
-
- Lars F.
- --
- / Mr.Lars Fosdal, Software Developer, Financial Analysis Systems /
- / Falcon Information Services AS, Stranden 1, N-0250 Oslo, Norway /
- / E-mail:lfosdal@falcon.no Tel:(47-2) 831310 Fax:(47-2) 831290 /
- -- All opinions are personal and does not reflect company policy --
-