Although the commands in this section are called NEWfile and USEfile, these are the commands which actually create new buffers, and which may - if that is the case - create a new file.
This command always creates a new file. The new file will be empty (no records in it), memory-based, and won't have any fields, except one. All files always have a MEMO field. This is a character field, which is supposed to be invisible. It always has fieldid zero, and can never be deleted. It is included to make sure a file always has a field, and so you can have invisible notes.
When a file is created, you immediatly have the possibility to set the filename. You don't have to do this, but it is always interesting to do so. It makes sure that you haven't got several un-named files flying about in memory, which can't be accessed by another job. You can create a file with a name that is already used by another file which is used, so be careful.
The new buffer will immediatly be the default buffer for the current job.
Sbasic NEWfile filename filename : [string] Assembler NEWF filename : [string] bufferid : return long C long DDnewfile(char *filename); errors, code, meaning imem -3 insufficient memory
This command creates a new buffer for a file with the given name. If there is no file in use with the given name, then the file will be loaded from the given device, or from the data_use device if the file can't be found. If there already was a file with given name, then another buffer to access that file will be created. To determine if a file already is in memory, the name is compared case dependant. If there is more than one file in memory with the same name, then you will probably get the last created one.
There is also a view parameter which can be set (<>0). If it is set, then the buffer will be read only, and no writing can be done through that buffer. Also the records that are viewed through such a buffer won't be locked by that buffer, and even record which are locked by another buffer can be viewed (you will get the version in the file, not the version in that other buffer).
The new buffer will immediatly be the default buffer for the current job, and there will be no record in the buffer (as after NEWrec).
The medium-file which is loaded needs the _ddf extension. This extension should not be specified or it will be included in the filename.
If a bufferid is passed, then a new buffer which accesses the same file will be created.
Sbasic USEfile #bufferid, filename, filedevice, view filename : string filedevice : [string] view : short[0] Assembler USE bufferid filename : string filedevice : [string] view : short C long DDusefile(long bufferid, char *filename, char *filedevice, short view); errors, code, meaning imem -3 out of memory fdnf -7 file not found maybe you just forgot to give a filename isyn -21 this is not a DATAdesign file iexp -17 the given DATAdesign file is too old ... any other file errorPROGS, Professional & Graphical Software