Autor |
Beitrag |
tomycat
Beiträge: 265
Erhaltene Danke: 1
|
Verfasst: Mi 26.04.23 18:16
|
|
Ralf Jansen
Beiträge: 4705
Erhaltene Danke: 991
VS2010 Pro, VS2012 Pro, VS2013 Pro, VS2015 Pro, Delphi 7 Pro
|
Verfasst: Mi 26.04.23 18:48
"Du mußt den Satz in Quotes setzen".
|
|
tomycat
Beiträge: 265
Erhaltene Danke: 1
|
Verfasst: Do 27.04.23 09:01
|
|
Th69
Beiträge: 4784
Erhaltene Danke: 1055
Win10
C#, C++ (VS 2017/19/22)
|
Verfasst: Do 27.04.23 09:05
Konsole 1:
| test.exe "Heute ist ein schöner Tag" |
|
|
tomycat
Beiträge: 265
Erhaltene Danke: 1
|
Verfasst: Do 27.04.23 11:37
thx,
aber wie kann ich den kompletten Satz in meinen String "meineEingabe" stecken.
|
|
jaenicke
Beiträge: 19285
Erhaltene Danke: 1743
W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
|
Verfasst: Do 27.04.23 12:02
|
|
tomycat
Beiträge: 265
Erhaltene Danke: 1
|
Verfasst: Do 27.04.23 16:15
args[0] ist das dann "hallo",
ich will das aber den ganzen Satz.
Moderiert von Th69: C#-Tags hinzugefügt
|
|
Ralf Jansen
Beiträge: 4705
Erhaltene Danke: 991
VS2010 Pro, VS2012 Pro, VS2013 Pro, VS2015 Pro, Delphi 7 Pro
|
Verfasst: Do 27.04.23 17:36
Nein wenn du quotest ist alles in dem Quote in einem Array Element von args.
Bei einem
C#-Quelltext 1:
| test.exe "erstes Argument" "zweites argument" |
dann enthält
Quelltext 1: 2:
| args[0] = "erstes Argument" args[1] = "zweites argument" |
Beachte das jetzt nicht an dem Leerzeichen in verschiedene Argumente getrennte wurde. erstes Argument wären 2 Argumente, "erstes Argument" wäre ein Argument.
Aber vielleicht probierst du es einfach aus?
Für diesen Beitrag haben gedankt: tomycat
|
|
tomycat
Beiträge: 265
Erhaltene Danke: 1
|
Verfasst: Mi 03.05.23 16:12
ich verstehe war ihr meint.
Ich frage mal anders,
ich habe einen langen Satz.
meinprog.exe 1 2 3 4 5 6 7 8
Gibt es eine Möglichkeit, einfach die Eingabe als String aufzunehmen?
|
|
Th69
Beiträge: 4784
Erhaltene Danke: 1055
Win10
C#, C++ (VS 2017/19/22)
|
Verfasst: Mi 03.05.23 16:48
-> Environment.CommandLine (inkl. Programmname/-pfad) oder
C#-Quelltext 1:
| string arguments = String.Join(" ", args); |
Aber was stört dich am Setzen der Anführungsstriche?
|
|