c code for a informix library-need help!
Posted in 2000
Topics: Connectivity: ESQL/C, 4GL & Embedded SQL
Need to know how to code a c function for a library called from a 4GL: c_readfile() is a C function designed to be called from an Informix 4GL Program. It accepts a /pathname/filename as its only argument and returns a status flag and string read from the given file. The status flag has the value "true" if the read was successful, and "false" if the read failed on the file. If the file cannot be opened "failed" (-1) ie returned. Successive reads to the same file can be used to read a file sequentially. In order to start over reading a file from the beginning you must first close the file for reading and then call c_readfile() again. The easiest way to accomplish this is by calling c_readfile() with a blank path_name argument. Usage: call c_Readfile(path_name) returning stat_flag, string Sent via Deja.com http://www.deja.com/ Before you buy.
jazevedo@my-deja.com wrote: > Need to know how to code a c function for a library called from a 4GL: > > c_readfile() is a C function designed to be called from an Informix 4GL > Program. It accepts a /pathname/filename as its only argument and > returns a status flag and string read from the given file. The status > flag has the value "true" if the read was successful, and "false" if the > read failed on the file. If the file cannot be opened "failed" (-1) ie > returned. Successive reads to the same file can be used to read a file > sequentially. In order to start over reading a file from the beginning > you must first close the file for reading and then call c_readfile() > again. > The easiest way to accomplish this is by calling c_readfile() with a > blank path_name argument. > > Usage: call c_Readfile(path_name) returning stat_flag, string > > Sent via Deja.com http://www.deja.com/ > Before you buy. Within your 4GL program you just write. call c_Readfile(path_name) returning variable1_name, variable2_name The value of variable1_name would be one of "true", "false" or -1 you can then use this to test if you need to do anything else. The value of variable2_name contains the information you required from the processes of reading the file in the first place, ( maybe the first 256 characters to start with, a second call would read the next and so on). -- Compliments of QueriX -------------------------------------------------------------------------------------------------- QueriX 4GL Compilers are Informix 4GL Compatible, and Connection to other RDBMS such as Oracle. Hydra 4GL Compiler (Compatible with I4GL) Compile once, run everywhere Phoenix Windows GUI. (Front End to 4GL) Chimera Java GUI The only GUI you will ever need... (Front End to 4GL) Arachne Web Technology (Front End to 4GL on the Web & HTML Report Generator) ESQL/C Compiler For more details visit: http://www.querix.com/ ---------------------------------------------------------------------------------------------------
jazevedo@my-deja.com wrote: > > Need to know how to code a c function for a library called from a 4GL: It's in the 4GL manual. There it explains how to pop arguments that 4GL passes to the function from the 4GL stack, what the REAL parameter and return of the 'C' function should be to be properly 4Gl callable, and how to push the results you want to return to 4GL onto the 4GL stack. There are also sample programs in your installation directory. Having said that there is a package available that sounds VERY similar to what you are trying to do from the IIUG Software Repository. Take a look, even if the file processing functions there are not what you want they will provide good examples of how-to-do-it. Art S. Kagel > c_readfile() is a C function designed to be called from an Informix 4GL > Program. It accepts a /pathname/filename as its only argument and > returns a status flag and string read from the given file. The status > flag has the value "true" if the read was successful, and "false" if the > read failed on the file. If the file cannot be opened "failed" (-1) ie > returned. Successive reads to the same file can be used to read a file > sequentially. In order to start over reading a file from the beginning > you must first close the file for reading and then call c_readfile() > again. > The easiest way to accomplish this is by calling c_readfile() with a > blank path_name argument. > > Usage: call c_Readfile(path_name) returning stat_flag, string > > Sent via Deja.com http://www.deja.com/ > Before you buy.