Quantcast
Channel: Visual COBOL - Forum - Recent Threads
Viewing all articles
Browse latest Browse all 4356

RE: calling managed from native

$
0
0

This appears to be a difference in the way that the command-line is returned between a native program and a managed program.

In a managed program, even a console application extra spaces are removed from the command line because it is assumed that these are individual parameters separated by a space so it reduces multiple spaces to a single space.

I tested this in 2.1 update 1 and it has the same behavior as 2.2.

You can make it return the entire command line as is by enclosing the parameters within quotes when passed in.

myprog.exe "11111      22222      333333"

when this is returned to the managed program via:

    accept my-command from command-line

my-command will contain the entire string including the enclosing quotes so those will have to be removed.

Something like:

          unstring my-command(2:) delimited by quote
             into passed-to-program

If you did not wish to change the calling program to include the quotes then you could alternatively use:

         set my-command to type Environment::CommandLine

my-command would then contain the entire command line including the program name so you would need to get rid of that.

Something like:          

         perform varying sub1 from length of my-command by -1 until sub1 = 0
             if my-command(sub1:1) = '"'
                add 2 to sub1
                exit perform
             end-if
          end-perform

          move my-command(sub1:) to passed-to-program

Thanks.


Viewing all articles
Browse latest Browse all 4356

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>