POV-Ray : Newsgroups : povray.unofficial.patches : #fopen and file creation Server Time
1 Nov 2024 01:22:44 EDT (-0400)
  #fopen and file creation (Message 1 to 3 of 3)  
From: Tom York
Subject: #fopen and file creation
Date: 8 Feb 2002 15:25:51
Message: <3c64344f$1@news.povray.org>
The #fopen command fails with a fatal error if I try to 
open a file that doesn't exist. Is it possible to get 
MegaPov to create a file if it doesn't exist? At the 
moment, I have to create empty files before running the 
scene that uses them for temporary storage, which is awkward 
and error-prone.

Thanks,

Tom


Post a reply to this message

From: Warp
Subject: Re: #fopen and file creation
Date: 8 Feb 2002 18:00:05
Message: <3c645874@news.povray.org>
What #fopen parameters are you using to open the file (which may not
exist)? If you open it for 'write', it should create it.

-- 
#macro M(A,N,D,L)plane{-z,-9pigment{mandel L*9translate N color_map{[0rgb x]
[1rgb 9]}scale<D,D*3D>*1e3}rotate y*A*8}#end M(-3<1.206434.28623>70,7)M(
-1<.7438.1795>1,20)M(1<.77595.13699>30,20)M(3<.75923.07145>80,99)// - Warp -


Post a reply to this message

From: Tom York
Subject: Re: #fopen and file creation
Date: 9 Feb 2002 09:44:41
Message: <3c6535d9$1@news.povray.org>
In article <3c645874@news.povray.org>, Warp wrote:
>  What #fopen parameters are you using to open the file (which may not
>exist)? If you open it for 'write', it should create it.

Sorry, my question was very badly phrased (and unnecessary,
as it turns out). I wanted to conditionally create the file.
I found after posting that the "append" mode did what I wanted. 
Too much time spent writing C programmes made me think
of testing the file handle for fopen success, rather than
looking at the available fopen modes more carefully!

Thanks,

Tom


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.