0 Members and 1 Guest are viewing this topic.
Calculates a unique file name to be used for a temporary file
Don't mean to be flip but please define create.
vl-filename-mktemp makes a unique file name, it's up to you to create it, i.e. (setq handle (open the_temp_file_name "w")) ...
Then just use the open function with a "W" argument. It creates the file to which you can 'write-line' strings.
Quote from: alanjt on April 20, 2011, 03:03:50 PMThen just use the open function with a "W" argument. It creates the file to which you can 'write-line' strings.That is just it. I do not want to write to it now. The user will fill in the file later. I just want an empty file. Really what I want to do is control the file name of the file so I can path to it.
(defun makeTextFile (filename / f) (if (setq f (open filename "W")) (progn (close f) (findfile filename)) ))
vl-filename-mktemp Return ValuesA string containing a file name, in the following format:directory\base<XXX><.extension>where:base is up to 5 characters, taken from patternXXX is a 3-character unique combination
(defun c:test () (setq UserFolder1 (strcat "\\Cad Docs and Files")) (setq UserFolder2 (strcat "\\Customization and Support Files")) (setq UserPath1 (strcat MyDocPrefx UserFolder1)) (setq UserPath2 (strcat UserPath1 UserFolder2)) (vl-mkdir UserPath1) ; checks to see if new folder is present and if not creates it. (vl-mkdir UserPath2) (setq DictFileName (strcat UsersLogInName " SpellDict.cus")) (setq DictFilePath (strcat UserPath2 "\\" DictFileName)) (setq DictFile (vl-filename-mktemp DictFilePath)) (setq tempfile (open DictFile "w")) (close tempfile))