Code Comments
Programming Forum and web based access to our favorite programming groups.I'm writing every element in a stem variable, one at a time, with a DO loop which contains a LINEOUT. Is there a way to write the whole smash with a single line of code, comparable to EXECIO on the mainframe? Daniel B. Martin
Post Follow-up to this message>"Daniel B. Martin" <daniel88b88martin@earthlink88.net> >I'm writing every element in a stem variable, one at a time, >with a DO loop which contains a LINEOUT. >Is there a way to write the whole smash with a single line >of code, comparable to EXECIO on the mainframe? Yes. The function LOADTEXT also has a save option.
Post Follow-up to this messageJeff Glatt wrote: > The function LOADTEXT also has a save option. Thank you, Jeff. I want to use LOADTEXT to write several stem variables to the same file, appending each to what was already written. I don't see an APPEND option. How may this be done? Daniel B. Martin
Post Follow-up to this message"Daniel B. Martin" <daniel88b88martin@earthlink88.net> wrote: > Jeff Glatt wrote: > > Thank you, Jeff. I want to use LOADTEXT to write several > stem variables > to the same file, appending each to what was already > written. I don't see > an APPEND option. How may this be done? Surely that depends on how you open the file? -- Jeremy C B Nicoll - my opinions are my own.
Post Follow-up to this message>I want to use LOADTEXT to write several stem variables >to the same file, appending each to what was already >written. Before you start making calls to LOADTEXT (for a given file), explicitly ope n that file (for writing) yourself. Use STREAM's "OPEN WRITE" if you wish to retain any current contents, or "OPEN WRITE REPLACE" if you want to create t he file empty. If LOADTEXT sees that the file is already open for writing, then LOADTEXT won't open the file itself, nor close it after writing out the stem . The net result is that several calls to LOADTEXT cause data to be appended. When you're done writing the file, you'll also need to close it via STREAM, or the file will remain open, and therefore other processes will be denied acce ss to it.
Post Follow-up to this messageJeff Glatt wrote: > Use STREAM's "OPEN WRITE" if you wish to > retain any current contents, or "OPEN WRITE REPLACE" if you want to create the > file empty. Perfect! Thank you! Daniel B. Martin
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.