Previous: sfor2c Up: Fortran String Conversion Routines Next: sfor2len


sfor2c_array(c_string, max_length, nelements, for_string, argptr, nargs,
             argno, strno);

This routine converts a Fortran string array to a standard C null-terminated array of strings. The returned C string array is a two-dimensional array of characters, not an array of pointers to strings. The Fortran string should be declared as a single-dimensional array of CHARACTER*n in the calling routine.

This routine is somewhat unusual in that it actually allocates the memory for the C string for you. You pass in the address of a character pointer, not the address of a buffer for the characters. sfor2c_array calls malloc() to allocate the required memory, and returns the address of that memory in the pointer. It is your responsibility to call free() to free up that memory when you are done with it.