[clean-list] freopen fails
Arjen van Weelden
A.vanWeelden at cs.ru.nl
Tue Jan 30 09:00:44 MET 2007
I tried your program and it just works. I used Clean 2.2 (32bit
Windows), what do you use? Could you please try the smaller example,
attached to this email, on your system? Have you tried passing the
filename along and using fclose and fopen?
regards,
Arjen
Erik Zuurbier wrote:
>
> Dear Cleaners,
>
> I have a case where freopen fails. The comments in the StdFile library say:
>
> freopen :: !*File !Int -> (!Bool,!*File)
> /* Re-opens an open file in a possibly different mode.
> The boolean indicates whether the file was successfully closed before
> reopening. */
> So I look at fclose:
>
> fclose :: !*File !*f -> (!Bool,!*f)
> /* Closes a file */
> I can imagine that closing fails if I remove a file by hand in the mean
> time, but that is not the case in my program.
> What could be the other conditions under which closing a file fails?
>
> Regards Erik Zuurbier
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> clean-list mailing list
> clean-list at science.ru.nl
> http://mailman.science.ru.nl/mailman/listinfo/clean-list
-------------- next part --------------
module Reopen
import StdEnv
Start world
# (ok, file, world) = fopen "file.txt" FWriteText world
| not ok = abort "fopen failed"
# file = fwrites "Everything worked!" file
# (ok, file) = freopen file FReadText
| not ok = abort "freopen failed"
# (string, file) = freadline file
# (ok, world) = fclose file world
| not ok = abort "fclose failed"
= (string, world)
More information about the clean-list
mailing list