Tapatalk

how to pass commandline arguments when running program?

how to pass commandline arguments when running program?

1
NewbieNewbie
1

    Nov 18, 2005#1

    Hi all,

    I was wondering if there is a way to pass some arguments when running a program. I have tried to modified the "command line arguments" option in the compile options from xxx.exe to xxx.exe arg1 arg2. But it won't work.

    Is it not the correct option I should setup or it is due to a bug from uestudio? :(

    61
    Advanced UserAdvanced User
    61

      Nov 19, 2005#2

      That is the correct way to do it. Are any of the command-line arguments paths or filenames containing spaces? If so, you need to put quotes around them.

      Which compiler are you using?

      strawberry
      strawberry

        Nov 21, 2005#3

        The compiler I used is Cygwin gcc. Anything wrong with this compiler?

        61
        Advanced UserAdvanced User
        61

          Nov 22, 2005#4

          IIRC, gcc runs under the Cygwin shell and not directly out of the Windows console. This is probably why it isn't working with UEStudio, but I never tried it myself.

          There is a native Windows port of gcc for Windows called MinGW, I believe, which DOES run from the command shell without having Cygwin installed.

          What other issues are you having except for the extra command-line arguments? Does it work at all?

          strawberry
          strawberry

            Nov 23, 2005#5

            Thanks for your answer, buddy. I am still wondering if there's a way I can change the default shell used by UEStudio? I used MinGW before but since I also use cygwin, I remove the MinGW from my computer. BTW, I think MinGW may lack some standard library. That's another reason why I removed it.

            strawberry
            strawberry

              Nov 24, 2005#6

              I have tried MinGW. It still won't work. My actual problem is to redirect the standard input to a text file, e.g.

              prog.exe < input.txt

              Seriously, is it really a bug from UltraStudio'05?

              61
              Advanced UserAdvanced User
              61

                Nov 26, 2005#7

                Does it work from the command line outside of UEStudio?

                I think there are probably going to be problems running your program like that from inside of UEStudio. Presumably, UEStudio calls CreateProcess() or something to run the application outside of the shell. But you need the shell in order to redirect standard input.

                It's probably less of a hassle to just run it from a batch file or from the command line. You can also try setting up a custom tool (under the "Advanced" menu). Alternatively, you could design your application so as to receive the file name as a command line argument and open it inside the application.

                strawberry
                strawberry

                  Nov 26, 2005#8

                  Yes. It works in the command line window outside of UEStudio.

                  1
                  NewbieNewbie
                  1

                    Oct 29, 2006#9

                    You can make UE portable (I tried v11+) by just moving the ini-file into the application directory. It always looks in the appdir for an ini-file.

                    The only problem is that relative paths (eg Language File=.\wordfile.txt) set in the ini-file are relative to the project-dir or the current working dir. Very inconvenient if you want to invoke your portable UE from another app, eg Total Commander.

                    An example: You browse to "C:" in TC, select a textfile and press F4 (invoke text editor, by default Notepad, but you can specify a custom texteditor, in this case I specified UE). TC invokes the portable UE and passes the name of the textfile as parameter. The problem is the current working dir becomes "C:" and UE searches for the wordfile in "C:".

                    To workaround, use a batchfile to invoke UE from other programs. Create a file called "startue.bat" in the UE-directory. Put the following command in the batchfile:

                    start /b /d%~dp0 %~dp0uedit32.exe %*

                    NOTE: Doesn't work under Win9x, only Win2k and higher.