- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I just encountered a problem to get the sub-strings that were originally and correctly input as argument below:
foo.exe file.dat ""Time " "Fx
I need to retrieve the arg2 containing three variables to be 3 sub-strings, however, I got 6.
Is there any trick behind the input?
Thanks,
Kong
Ps: I found the below, but not TRUE on my pc.
https://msdn.microsoft.com/en-us/library/system.environment.getcommandlineargs%28v=vs.110%29.aspx
gives MyApp \\\\\"alpha \"beta ==>> MyApp, \\"alpha, "beta
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think you will have to use GET_COMMAND to retrieve the entire command-line without any interpretation and parse it yourself. The problem you see is likely due to the command-line parser not seeing the nested doubled quotes as nested.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, I tried GET_COMMAND in Cygwin, but it still strips off the inner double quotes.
In MS-Dos, it succeeds by typing this, but obviously too lengthy...
foo.exe file.dat """"Time
""" """Fx""" """xPos """"
Thanks a lot.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try this instead:
program "'Time ' 'Fx
The shell/command window will leave the inner single quotes as they and considers everything a single argument. Within your Fortran program you can use list-directed input (read(string,*)) to retrieve the individual parts.
I tried this in a command window under Windows and in a shell window under Cygwin. Both remove the outer double quotes, but leave the inner single quotes intact
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page