× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I am attempting to create an IFS text file which has the contents of another
IFS text file embedded somewhere in the middle of it.  I'm attempting to do
this in an RPG program using the read() and write() API's.  Basically, I'm:
1) creating the first file (using an open() with O_CREAT)
2) writing some text to it
3) opening the second file
4) reading it
5) writing the contents of the second to the first
6) closing the second file
7) writing some more text to the first file
8) closing the first file

Unfortunately, this is not working the way I'd hoped.  The contents of the
second IFS file appear as garbage in my first file even though both are
ASCII files.  In my RPG program, I open the first file as follows:
Eval      FileDesc = open(%ADDR(FullName)
            : O_CREAT + O_WRONLY + O_TRUNC +
              O_CODEPAGE
            : S_IRWXU + S_IROTH
            : AsciiCodePage)

Then I close it:
Eval      ReturnInt = close(FileDesc)

Then I reopen it.
Eval      FileDesc = open(%ADDR(FullName)
            : O_TEXTDATA + O_RDWR)

Then I write some text to it.  This is the technique I always use and it's
worked fine for other things but I can't figure out how to get the contents
of the first to not be garbage.  I don't think it has anything to do with
codepages but am not sure.

Any ideas?

Dave

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.