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
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
> 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
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.
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).
> 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
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
Code
_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.