View Full Version : How do I call fread() C API from an ILE RPG program??
03-02-2004, 08:55 AM
There is not a big trick to this. Just use the QC2LE binding directory when you compile your RPG pgm. What problem are you having? Jeff
03-02-2004, 09:22 AM
> I have found the the prototype declaration, but not sure >how to declare this API and use it in the ILE RPG program. The FAQ at http://faq.midrange.com has an answer regarding how to prototype C functions in RPG. The archives will probebly help you find an IFS tutorial http://archive.midrange.com Also, the RPG Redbook has examples of dealing with the IFS. The address to the Redbook is in the FAQ. --buck
03-03-2004, 12:56 AM
I am using the declaration as show in the green screen, however, I am not sure if the declaration is correct for parameters 2 and 3. C function suggest the parameter 2 and 3 should be size_t type - not sure what RPG equivalent should be. I have tried the above declaration, but it doesn't read any data from the file. File is opened successfully.
03-03-2004, 08:01 AM
size_t is defined in qsysinc/h(stdlib) as being an unsigned int. For ILE RPG this would be 10u 0 (which is what your prototype has).
03-03-2004, 08:15 AM
> I have tried the above declaration, but it doesn't > read any data from the file. File is opened successfully. I am not familiar with that _C_IFS_fread. May I suggest again that you look at the Redbook and archives? I know there are working examples of read() and write() in both places, and probably fread/fwrite as well. --buck
03-03-2004, 09:32 AM
I have found the the prototype declaration, but not sure how to declare this API and use it in the ILE RPG program. I need to read and write data in a binary mode. Any help will be appriciated. Thanks <hr width=50 align=left>Code ('http://www.mcpressonline.com/mc/showcode@@.6ae9adab')
03-03-2004, 09:32 AM
_C_IFS_fread() is what fread() maps to when *IFSIO is specified on CRTCMOD or CRTBNDC and is found in qsysinc/h(ifs). The usage is the same as for fread() and fread() examples can be found in the ILE C/C++ Run-time Library Functions manual under fread.
Powered by vBulletin® Version 4.1.5 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.