× 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.




D WriteIFSRec     PR              *   ExtProc('_C_IFS_fputs')
D  ouBuffer                       *   Value Options(*STRING)
D  stream_FILE                    *   Value

This prototype is wrong, but not in the way I expected it to be! The fputs() API returns an integer, not a pointer. So the correct prototype would look like this:

   D WriteIFSRec     PR            10i 0 ExtProc('_C_IFS_fputs')
   D  ouBuffer                       *   Value Options(*STRING)
   D  stream_FILE                    *   Value

When you call it, make sure of the following:

a) do not use %addr() or a pointer for the first parameter! You should code your variable name directly, or if you want to remove blanks, put it inside a %trim() or %trimr(). Do not use %addr or a pointer when you have options(*string) coded.

b) The second parameter should be the pointer that was returned by the fopen() API.

c) Consider changing the prototype name from "WriteIFSRec" to "fputs". fputs() is an ANSI standard API included in every C runtime library on every platform. Renaming it to something else just confuses people and makes it harder to understand what you're talking about. It also makes it harder to find info in the manual. Just a tip.

You could use the IFS APIs (instead of the ILE C runtime APIs) but there'd be no advantage to them in this case, in fact, fputs() might even be easier to use.

As luck would have it, I just wrote an article about the ILE C runtime APIs for the IFS, it's set to be sent in the Thursday edition of my newsletter -- however, it doesn't demonstrate writing data, only reading. Maybe I'll write a follow-on that explains writing in a future newsletter.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

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.