|
From: | Michael Anderson |
Subject: | Re: [open-cobol-list] File path. |
Date: | Wed, 08 May 2013 11:39:59 -0500 |
User-agent: | Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 |
Yes, this is odd.
Not sure if it will make a difference in this case, but...... in C, strings are terminated by null, this is how C determines the length of the string. Without the null your string may include more data than you expected, as the program continues walking though memory until a null is encountered, or until it walks right off the stack and core dumps. As a "Best Practice" kinda thing, when calling any "C" subroutine I first initialize all strings with LOW-VALUES, which is nulls, and then use string instead of move. So, I'm curious; If you first MOVE LOW-VALUES (instead of SPACES) to myfilepath and myfilename, will the results be the same? Is the "" as the last STRING parm in your second example really a null char? If so, then that is why the results are different. There is a compiler setting to null terminate all string/char parms in all call statements. -fnull-param Pass extra NULL terminating pointers on CALL statements Just my $0.02 -- Mike. On 05/08/2013 10:20 AM, studiok wrote:
|
[Prev in Thread] | Current Thread | [Next in Thread] |