MAIN PARAMETERS

Hier können die Unterschiede, Fehler und Probleme zwischen den Versionen bzw. bei der Migration besprochen werden

Moderator: Moderatoren

Antworten
simofranz
Rookie
Rookie
Beiträge: 15
Registriert: Mo, 26. Sep 2016 17:11

MAIN PARAMETERS

Beitrag von simofranz »

if I pass the parameters of a path in a program compiled in version 1.9, for example:

<test.prg>
FUNCTION main (cParam1,cParam2,cParam3,cParam4,cParam5,cParam6)

>TEST.exe aaa bbb ccc ddd eee "folder 1\folder 2\folder 3"
?cParam6
folder 1\folder 2\folder 3
***right

>TEST.exe aaa bbb ccc ddd eee "folder 1\folder 2\folder 3\"
?cParam6
folder 1\folder 2\folder 3\
***right


If i compile it using xb2.0:

>TEST.exe aaa bbb ccc ddd eee "folder 1\folder 2\folder 3"
?cParam6
folder 1\folder 2\folder 3
***right

>TEST.exe aaa bbb ccc ddd eee "folder 1\folder 2\folder 3\"
?cParam6
folder 1\folder 2\folder 3\"
***wrong -> the CHR(32) character is added to the string


why ?
Benutzeravatar
brandelh
Foren-Moderator
Foren-Moderator
Beiträge: 15745
Registriert: Mo, 23. Jan 2006 20:54
Wohnort: Germersheim
Hat sich bedankt: 77 Mal
Danksagung erhalten: 41 Mal
Kontaktdaten:

Re: MAIN PARAMETERS

Beitrag von brandelh »

It would be nice to give us a PRG for testing, but ok i wrote it myself:

Code: Alles auswählen

#include "Gra.ch"
#include "Xbp.ch"
#include "Common.ch"
FUNCTION main (cParam1,cParam2,cParam3,cParam4,cParam5,cParam6)
? version()+chr(9)+version(1)+"."+version(2)+"."+version(3)
?
? cParam6
?
return nil
with the new version, compiled (test.cmd):

Code: Alles auswählen

 9:17:49,88
 02.08.2024
 D:\TEMP
 Xbase++ (R) Compiler 2.00.2209 Jul 30 2024
 Copyright (c) Alaska Software. All rights reserved.
 File: test.prg Lines:   12
 File test.prg successfully compiled. 
 Alaska 32-Bit Linker Version 2.00.2209
 Copyright (c) Alaska Software 1997-2024. All rights reserved.
 Drücken Sie eine beliebige Taste . . .  
 
I got this correct output:

Code: Alles auswählen

D:\TEMP>TEST.exe aaa bbb ccc ddd eee "folder 1\folder 2\folder 3"
Xbase++ (R) Version 2.00 (2.00.2209) 

folder 1\folder 2\folder 3 

D:\TEMP> 
but if I call this, then I have a " at the end too

Code: Alles auswählen

TEST.exe aaa bbb ccc ddd eee "folder 1\folder 2\folder 3""
Dateianhänge
Test.zip
(487 Bytes) 93-mal heruntergeladen
Gruß
Hubert
Benutzeravatar
brandelh
Foren-Moderator
Foren-Moderator
Beiträge: 15745
Registriert: Mo, 23. Jan 2006 20:54
Wohnort: Germersheim
Hat sich bedankt: 77 Mal
Danksagung erhalten: 41 Mal
Kontaktdaten:

Re: MAIN PARAMETERS

Beitrag von brandelh »

OK ... I was wrong, you had this \" at the end.

have a look here, thats the reason why:

https://en.wikipedia.org/wiki/Escape_sequence
on this side hat geschrieben: For example, the single quotation mark character might be expressed as '\'' since writing ''' is not acceptable.

Many modern programming languages specify the doublequote character (") as a delimiter for a string literal.
The backslash escape character typically provides ways to include doublequotes inside a string literal,
such as by modifying the meaning of the doublequote character embedded in the string (\"),
or by modifying the meaning of a sequence of characters including the hexadecimal value of a doublequote character (\x22).
Both sequences encode a literal doublequote (").
Xbase++ should not do this, but it is written in C oder C++ ;-)

Call the support what they mean

The german version is here:

https://de.wikipedia.org/wiki/Escape-Sequenz
Gruß
Hubert
Benutzeravatar
brandelh
Foren-Moderator
Foren-Moderator
Beiträge: 15745
Registriert: Mo, 23. Jan 2006 20:54
Wohnort: Germersheim
Hat sich bedankt: 77 Mal
Danksagung erhalten: 41 Mal
Kontaktdaten:

Re: MAIN PARAMETERS

Beitrag von brandelh »

But the best way is to test the path inside your app.

1. Killl all " or blanks at the end of the string.
2. If there is no \ at the end, add one
Gruß
Hubert
simofranz
Rookie
Rookie
Beiträge: 15
Registriert: Mo, 26. Sep 2016 17:11

Re: MAIN PARAMETERS

Beitrag von simofranz »

thanks brandelh
I'll patch it up as you advise me but I think I'll ask technical support to investigate
Antworten

Zurück zu „Unterschiede Version 1.9 <-> 2.0“