File_I/O Commands
Rodgers Hemer
r.hemer at w-link.net
Sun Jan 2 10:26:22 PST 2011
On Jan 1, 2011, at 3:43 PM, Brian K. White wrote:
> On 1/1/2011 5:11 PM, Rodgers Hemer wrote:
>> I would be most appreciative if someone would provide me a real world example of the File I/O open and write commands. I have tried to follow the help pages for these commands but they are confusing with their repetitive use of "aa=" and none of my efforts pass the syntax check.
>>
>> I want to create/open a file to which a single line consisting of a full path name of another file is written. For example, create/open a new file named xxx in /u/appl/tmp/. Then write the full path name of another file in the new file.
>>
>> All help will be much appreciated.
>>
>> Thanks
>>
>> Rodgers Hemer
>
>
> N = "/path/to/some/file"
> H = open(N,"cw0t")
> D = "some data"
> x = writeline(H,D)
> x = close(H)
>
Brian:
Thanks. You did answer my question with the brief summary above. To me, it is much clearer than the help files. I know how to do the other file handling with filePro and shell scripts. It was just filePro's file I/O syntax that confused me.
Rodgers Hemer
> But you didn't really say enough, and so this example, while perfectly
> valid and real world, probably won't be much use.
>
> Rather than spend the next half hour going over a bunch of possible
> scenarios about what you might be really trying to do with the file, and
> how best to deal with them, I've answered the question you asked, and
> you'll have to ask a better question to get a better answer.
>
> What is the file to be used for?
> Under what circumstances is this process that creates the file run? (a
> user-initiated process? a root owned cron job? a wwwrun or nouser owned
> cgi? etc)
> Under what circumstances is this process that reads the file run?
> (same examples as above)
>
> These things determine what steps you need to take to deal with file
> permissions, and discarding of the file when it's no longer needed.
>
> The sample above will have the filepro clerk or report binary creating
> the file, and doesn't try to delete the file since I'm assuming you need
> some other process to read the file, and since filepro is creating the
> file, only filepro or root will be able to delete the file later.
>
> So the other process needs to be another filepro process, and "x =
> remove(N)" should work to delete it, or if it's anything else it needs
> to be root owned like a cron job. Otherwise you need to pre-create the
> file with a system command before the open() command, and remove the "c"
> from the open() options.
>
> --
> bkw
> _______________________________________________
> Filepro-list mailing list
> Filepro-list at lists.celestial.com
> Subscribe/Unsubscribe/Subscription Changes
> http://mailman.celestial.com/mailman/listinfo/filepro-list
More information about the Filepro-list
mailing list