• Welcome to Jose's Read Only Forum 2023.
 

CSED & command line to program

Started by Paul Elliott, February 04, 2012, 04:04:06 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Paul Elliott

Hello,

I'm having problems with CSed running a program & supplying a command line.
I typed in a simple command line of 1 word and have tried the various run options
but none of them are passing the command line.

Simple sample program is below.

What am I doing wrong?  It does work outside of CSed running from the command prompt.
Running under XP.


#DIM ALL
#COMPILE EXE
%UNICODE = 1

' // Include files for external files
#INCLUDE ONCE "CWindow.inc"     ' // CWindow class

' ========================================================================================
' Main
' ========================================================================================
FUNCTION WinMain (BYVAL hInstance AS DWORD, BYVAL hPrevInstance AS DWORD, BYVAL lpszCmdLine AS WSTRINGZ PTR, BYVAL nCmdShow AS LONG) AS LONG
   local wcmd as wstring
   local cmd as string
   
   wcmd = @lpszCmdLine
   cmd = wcmd
   msgbox "wcmd =" & wcmd
   showit cmd

END FUNCTION
' ========================================================================================
sub showit(x as string)
   msgbox "string cmd >" & x
end sub


José Roca

Indeed. It will happen the same with any other editor. Try it with the PB IDE if you want. The command line is passed by the operating system to the program when you run it from the command prompt.

Paul Elliott

I don't understand.

If I Set Command Line in PB v10 Editor to a simple word and compile/run then the
program gets that word.

But not in CSED.  In searching the CSED source I can only see 1 occurance of
pSed.CommandLine ( in csed.bas where it gets set ).


José Roca

Ah! That command line. Sorry, I was thinking in another thing.
Go to Menu-->Run-->Command Line

Paul Elliott

That's what I'm talking about.  I can not get it to pass that info to the program it just compiled.

Maybe it takes a later version of Windows than XP. But I can only find 1 occurance of
pSed.CommandLine in the cSED v1.03 source files. And that is just setting the value.
It is never used.

Did you try compiling & running the sample code?


José Roca

#5
Yes, but I'm using version 1.04, not yet released. This is one of the several small changes that I have done to this new version.

Looking at the code of the file CSED_COMPILE.INC (lines 710-712) you can see:


                           strCommand = strExeFile
'                              IF LEN(g_strCommandLine) THEN strCommand = strCommand & " " & g_strCommandLine
                           r = SHELL(strCommand, 1)


In the new version it has been replaced by:


                           strCommand = strExeFile
                           IF LEN(pSed.CommandLine) THEN strCommand = strCommand & " " & pSed.CommandLine
                           r = SHELL(strCommand, 1)


Paul Elliott