Appends a null character to each character constant expression that is passed as a dummy argument, making it more convenient to pass strings to C functions.
This option allows you to pass strings to C functions without having to add a null character to each string argument.
.-nonullterm-. >>- -q--+-nullterm---+-----------------------------------------><
@PROCESS:
@PROCESS NULLTERM | NONULLTERM
-qnonullterm
The result values from the CHAR and ACHAR intrinsic functions also have a null character added to them if the arguments to the intrinsic function are constant expressions.
This option does not change the length of the dummy argument, which is defined by the additional length argument that is passed as part of the XL Fortran calling convention.
This option affects those arguments that are passed with or without the %REF built-in function, but it does not affect those that are passed by value. This option does not affect character expressions in input and output statements.
@PROCESS NONULLTERM
SUBROUTINE CALL_C_1
CHARACTER*9, PARAMETER :: HOME = "/home/luc"
! Call the libc routine mkdir() to create some directories.
CALL mkdir ("/home/luc/testfiles\0", %val(448))
! Call the libc routine unlink() to remove a file in the home directory.
CALL unlink (HOME // "/.hushlogin" // CHAR(0))
END SUBROUTINE
@PROCESS NULLTERM
SUBROUTINE CALL_C_2
CHARACTER*9, PARAMETER :: HOME = "/home/luc"
! With the option, there is no need to worry about the trailing null
! for each string argument.
CALL mkdir ("/home/luc/testfiles", %val(448))
CALL unlink (HOME // "/.hushlogin")
END SUBROUTINE
!