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 ?
MAIN PARAMETERS
Moderator: Moderatoren
- brandelh
- 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
It would be nice to give us a PRG for testing, but ok i wrote it myself:
with the new version, compiled (test.cmd):
I got this correct output:
but if I call this, then I have a " at the end too
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
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 . . .
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>
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
Hubert
- brandelh
- 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
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
Call the support what they mean
The german version is here:
https://de.wikipedia.org/wiki/Escape-Sequenz
have a look here, thats the reason why:
https://en.wikipedia.org/wiki/Escape_sequence
Xbase++ should not do this, but it is written in C oder C++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 (").
Call the support what they mean
The german version is here:
https://de.wikipedia.org/wiki/Escape-Sequenz
Gruß
Hubert
Hubert
- brandelh
- 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
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
1. Killl all " or blanks at the end of the string.
2. If there is no \ at the end, add one
Gruß
Hubert
Hubert
Re: MAIN PARAMETERS
thanks brandelh
I'll patch it up as you advise me but I think I'll ask technical support to investigate
I'll patch it up as you advise me but I think I'll ask technical support to investigate