Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Problem with BGI-drivers if readonly

2 views
Skip to first unread message

Christian Andretzky

unread,
Aug 5, 1991, 6:32:56 PM8/5/91
to
We are using Turbo pascal in education and many of our students are absolutely
beginners. It seems to be good, that BGI-files are readonly to prevent
corrupting these files. But the problem is, Turbo will produce the error
"file not found" when calling InitGraph procedure.
This appears because InitGraph uses the DOS call open read/write for opening
BGI-driver. I think, a DOS call open read should be enough.

Does anybody know, how to solve this problem ?

Thanks Christian

P.S. Sorry, my english is not so good, it is not my native language.
--
+============================================================================+
| Name: Christian Andretzky >:::::::::::::::::< |
| Institute: TU Chemnitz, Fachbereich Maschinenbau III >:::::::::::::::::< |
| Room: Reichenhainer Str. 70, Zi. D036 >:::::::::::::::::< |

Timo Salmi

unread,
Aug 6, 1991, 1:01:33 AM8/6/91
to
In article <casys.681431576@obelix> ca...@obelix.hrz.tu-chemnitz.de writes:
:

>corrupting these files. But the problem is, Turbo will produce the error
>"file not found" when calling InitGraph procedure.
>This appears because InitGraph uses the DOS call open read/write for opening
>BGI-driver. I think, a DOS call open read should be enough.
:

No guarantees, but have you tried setting FileMode := 0; prior the
call to your read-only bgi files.

...................................................................
Prof. Timo Salmi
Moderating at garbo.uwasa.fi anonymous ftp archives 128.214.87.1
School of Business Studies, University of Vaasa, SF-65101, Finland
Internet: t...@chyde.uwasa.fi Funet: gado::salmi Bitnet: salmi@finfun

Albert Q.Zhou

unread,
Aug 6, 1991, 5:59:01 AM8/6/91
to
In article <casys.681431576@obelix> ca...@obelix.hrz.tu-chemnitz.de writes:
>We are using Turbo pascal in education and many of our students are absolutely
>beginners. It seems to be good, that BGI-files are readonly to prevent
>corrupting these files. But the problem is, Turbo will produce the error
>"file not found" when calling InitGraph procedure.
>This appears because InitGraph uses the DOS call open read/write for opening
>BGI-driver. I think, a DOS call open read should be enough.
>

What you could do is to override InitGraph and CloseGraph as following:

procedure InitGraph;
Set BGI files to file mode as ordinary file;
call Graph.InitGraph(...);
end;

procedure CloseGraph;
call Graph.CloseGraph;
Set BGI files back to file mode as read only;
end;

:

Christian Andretzky

unread,
Aug 7, 1991, 8:20:58 PM8/7/91
to
t...@uwasa.fi (Timo Salmi) writes:

>In article <casys.681431576@obelix> ca...@obelix.hrz.tu-chemnitz.de writes:
>:
>>corrupting these files. But the problem is, Turbo will produce the error
>>"file not found" when calling InitGraph procedure.
>>This appears because InitGraph uses the DOS call open read/write for opening
>>BGI-driver. I think, a DOS call open read should be enough.
>:

>No guarantees, but have you tried setting FileMode := 0; prior the
>call to your read-only bgi files.

Thanks for Your answer, You are right.

But I think the question for me is:

Why should I do some maniplations, i. e. setting file mode or other,
if there is no need to use an read write open call in Borlands
GRAPH.TPU?

I think, it sould be better, to do something against the cause of this
(i. e. patching GRAPH.TPU), as to do something against the consequences.

The best way to solve this problem seems to be an patch in GRAPH.TPU and
reporting this problem to Borland, so they may solve this problem generally
for future versions.

BTW, calling Borlands Hotline in germany was without results. They dont know
this problem and they had no answer or hint.

Christian

--
+============================================================================+
| Name: Christian Andretzky >:::::::::::::::::< |

| Address: Technische Universitaet Chemnitz >:::::::::::::::::< |
| Fachbereich Maschinenbau III >:::::::::::::::::< |
| Reichenhainer Str. 70 >:::::::::::::::::< |
| Chemnitz >:::::::::::::::::< |
| D-O-9022 >:::::::::::::::::< |
| Phone: +37 71 561 2130 >:::::::::::::::::< |
| FAX: +37 71 561 2413 >:::::::::::::::::< |
| mail: ca...@obelix.hrz.tu-chemnitz.de >:::::::::::::::::< |
+============================================================================+


--
+============================================================================+
| Name: Christian Andretzky >:::::::::::::::::< |

| Address: Technische Universitaet Chemnitz >:::::::::::::::::< |
| Fachbereich Maschinenbau III >:::::::::::::::::< |

Timo Salmi

unread,
Aug 8, 1991, 1:46:36 AM8/8/91
to
In article <casys.681610858@obelix> ca...@obelix.hrz.tu-chemnitz.de writes:

>t...@uwasa.fi (Timo Salmi) writes:
>>No guarantees, but have you tried setting FileMode := 0; prior the
>>call to your read-only bgi files.
>
>Thanks for Your answer, You are right.
>But I think the question for me is:
>Why should I do some maniplations, i. e. setting file mode or other,
>if there is no need to use an read write open call in Borlands
>GRAPH.TPU?

Well, what can I say except that because Turbo Pascal has such a
feature when handling readonly files. If you want an access to
readonly files in TP, you just have to reset the FileMode variable
from its default value of 2. It is really not a manipulation in a
true sense of the word, since the original .bgi files are not
touched like they would be if your program first would change the
file attribites of the .bgi files. (That might be another solution.
Strongly _not_ recommended).

David Conrad

unread,
Aug 11, 1991, 8:15:48 AM8/11/91
to
In article <12...@j.cc.purdue.edu> zh...@brazil.psych.purdue.edu (Albert Q.Zhou) writes:
>In article <casys.681431576@obelix> ca...@obelix.hrz.tu-chemnitz.de writes:
>>We are using Turbo pascal in education and many of our students are absolutely
>>beginners. It seems to be good, that BGI-files are readonly to prevent
>>corrupting these files. But the problem is, Turbo will produce the error
>>"file not found" when calling InitGraph procedure.
>>This appears because InitGraph uses the DOS call open read/write for opening
>>BGI-driver. I think, a DOS call open read should be enough.
>>
>

I would be surprised if they managed to screw up the .BGI files, but....
You could try setting filemode to 0 before calling initgraph, or

>What you could do is to override InitGraph and CloseGraph as following:
>
>procedure InitGraph;
> Set BGI files to file mode as ordinary file;
> call Graph.InitGraph(...);
>end;
>
>procedure CloseGraph;
> call Graph.CloseGraph;
> Set BGI files back to file mode as read only;
>end;
>
>:

Better yet, just write a new InitGraph:

procedure InitGraph (var grd, grm : integer; path : string);
begin
make_read_write (path + '\*.BGI');
initgraph (grd, grm, path);
make_read_only (path + '\*.BGI');
end;

Then you just need to write the make_read_* procedures.

David R. Conrad, da...@michigan.com
--
= CAT-TALK Conferencing Network, Computer Conferencing and File Archive =
- 1-313-343-0800, 300/1200/2400/9600 baud, 8/N/1. New users use 'new' -
= as a login id. AVAILABLE VIA PC-PURSUIT!!! (City code "MIDET") =
E-MAIL Address: da...@Michigan.COM

David Conrad

unread,
Aug 12, 1991, 6:19:14 AM8/12/91
to
In article <casys.681610858@obelix> ca...@obelix.hrz.tu-chemnitz.de writes:
>t...@uwasa.fi (Timo Salmi) writes:
>
>>No guarantees, but have you tried setting FileMode := 0; prior the
>>call to your read-only bgi files.
>
>Thanks for Your answer, You are right.
>
>But I think the question for me is:
>
>Why should I do some maniplations, i. e. setting file mode or other,
>if there is no need to use an read write open call in Borlands
>GRAPH.TPU?
>

Oooh! Good point! The real answer to the question is, just link the
drivers in! Then you don't need to open the files in any mode!

>The best way to solve this problem seems to be an patch in GRAPH.TPU and
>reporting this problem to Borland, so they may solve this problem generally
>for future versions.
>

Tell them, but is setting filemode to 0 or linking in the drivers really
such a difficulty that you would bother to patch the Graph unit?

>BTW, calling Borlands Hotline in germany was without results. They dont know
>this problem and they had no answer or hint.
>

Too bad, I would hope that they would be sharp enough to figure this out.
Perhaps they should post the questions they receive here; we certainly had
no trouble with this one. Anyone at Borland listening? If you guys are
looking to hire Tech Support people, I'm available. :-)

>Christian

David Conrad

unread,
Aug 12, 1991, 6:12:34 AM8/12/91
to
In article <1991Aug11.1...@tygra.Michigan.COM> da...@tygra.Michigan.COM (David Conrad) writes:
>
>Better yet, just write a new InitGraph:
>
>procedure InitGraph (var grd, grm : integer; path : string);
>begin
> make_read_write (path + '\*.BGI');
> initgraph (grd, grm, path);
> make_read_only (path + '\*.BGI');
>end;
>

Ooooops! Make that call `Graph.InitGraph (grd, grm, path);',
otherwise you get a dynamic halt! :-)

Albert Q.Zhou

unread,
Aug 13, 1991, 2:45:54 AM8/13/91
to
>Better yet, just write a new InitGraph:
>
>procedure InitGraph (var grd, grm : integer; path : string);
>begin
> make_read_write (path + '\*.BGI');
> initgraph (grd, grm, path);

You have to say Graph.initgraph(...). Otherwise, it just calls itself
recursively.

> make_read_only (path + '\*.BGI');

I suppose BGI file is kept open until closegraph is called. It is illegal
to change filemode when the file is still open.

>end;
>

0 new messages