|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
#1
|
|||
|
|||
function that me controls the existence a file
It exists in me10 a function that me controls the existence of a direttory or a file and in case I does not exist creates?
Sorry for my English bad. |
#2
|
||||
|
||||
Re: function that me controls the existence a file
Check out your LISP manual. For files, the LISP open function does what you want - see http://www.lisp.org/HyperSpec/Body/fun_open.html. For example:
Code:
(setf s (open "foobar" :direction :output :if-does-not-exist :create)) Claus
__________________
CoCreate Modeling FAQ: http://www.clausbrod.de/CoCreateModeling/ |
#3
|
|||
|
|||
Re: function that me controls the existence a file
For macro in to ME10 ???????
|
#4
|
||||
|
||||
Re: function that me controls the existence a file
Oops - sorry. I should be reading those posts more carefully 8-(
I don't know too much about OSDD's macro language, but the CREATE_DIRECTORY command might do what you need for directories. If the directory doesn't exist already, it will create it, otherwise issue an error (which you can probably catch using TRAP_ERROR). For files, OPEN_OUTFILE with option DEL_OLD might do the trick. Sorry again for the misunderstanding. Claus
__________________
CoCreate Modeling FAQ: http://www.clausbrod.de/CoCreateModeling/ |
#5
|
||||
|
||||
Re: function that me controls the existence a file
There may be a better way, but some of our macros use logic like this to test for the existence of a file.
Code:
LET Test_file_name 'C:\my_file.txt' TRAP_ERROR OPEN_INFILE 1 Test_file_name END IF (CHECK_ERROR) {file does not exist} OPEN_OUTFILE 1 Test_file_name Commands... ELSE {file exists} CLOSE_FILE 1 Commands... END_IF
__________________
John Scheffel |
#6
|
|||
|
|||
Re: function that me controls the existence a file
thank you very much!
|
#7
|
||||
|
||||
Re: function that me controls the existence a file
Good also for me!
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
|
|