New to fortran, I am running into some issues when attempting to combine string concatenation with the "//" operator and control codes (such as the new line "\n") with the QuickWin function messageBoxQQ.
The following code properly displays the message box with its output:
sMsg = 'First and\nSecond lines'C
iRet = messageBoxQQ(sMsg,'Title'//' bar'C, MB$OK)
Title Bar
---------
First and
Second lines
When I try to concatenate, the output fails:
sMsg = 'First and\nSecond'
sMsg2 = TRIM(sMsg)//' lines'C
iRet = messageBoxQQ(sMsg2,'Title'//' bar'C, MB$OK)
Title Bar
---------
First and\nSecond lines
sMsg = 'First and\nSecond'C
sMsg2 = TRIM(sMsg)//' lines'C
iRet = messageBoxQQ(sMsg2,'Title'//' bar'C, MB$OK)
Title Bar
---------
First and
Second
One of the key applications, is to be able to display an error message of
'File filename not found.'
by concatenating the filename variable with the remainder of the string.
Apparantly, I have a misconception regarding the use of either control codes and null-terminated strings in Fortran, the concatenation operators, or the TRIM function. (or perhaps all three!) I do understand the results of the last example, as the EOL character apparantly was concatenated within the string, causing early termination. The other is beyond me.
I would greatly appreciate any insights anyone may share to help me produce the desired results.
The following code properly displays the message box with its output:
sMsg = 'First and\nSecond lines'C
iRet = messageBoxQQ(sMsg,'Title'//' bar'C, MB$OK)
Title Bar
---------
First and
Second lines
When I try to concatenate, the output fails:
sMsg = 'First and\nSecond'
sMsg2 = TRIM(sMsg)//' lines'C
iRet = messageBoxQQ(sMsg2,'Title'//' bar'C, MB$OK)
Title Bar
---------
First and\nSecond lines
sMsg = 'First and\nSecond'C
sMsg2 = TRIM(sMsg)//' lines'C
iRet = messageBoxQQ(sMsg2,'Title'//' bar'C, MB$OK)
Title Bar
---------
First and
Second
One of the key applications, is to be able to display an error message of
'File filename not found.'
by concatenating the filename variable with the remainder of the string.
Apparantly, I have a misconception regarding the use of either control codes and null-terminated strings in Fortran, the concatenation operators, or the TRIM function. (or perhaps all three!) I do understand the results of the last example, as the EOL character apparantly was concatenated within the string, causing early termination. The other is beyond me.
I would greatly appreciate any insights anyone may share to help me produce the desired results.