Returning char* from C routines in Visual COBOL under Unix

[Migrated content. Thread originally posted on 03 February 2012]

Hello,

I found that when I perform two calls to a C program, and the second string returned by C is smaller than the first one, COBOL does not recognize the 0x0 character and shows the two strings overlapped.

For example:

The first call returns 'file11111.txt', and the second 'file2.txt'. Then COBOL understands 'file2.txt txt'.

Dump of p_szFile in C program ='file11111.txt'                                 
66 69 6C 65 31 31 31 31 31 2E 74 78 74                                         
FILE-W IN COBOL=file11111.txt

Dump of p_szFile in C program ='file2.txt'                                     
66 69 6C 65 32 2E 74 78 74                                                     
FILE-W IN COBOL=file2.txt txt