Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #169009

Re: Interesting case that I can't workout!!!!

From Keith Thompson <Keith.S.Thompson+u@gmail.com>
Newsgroups comp.lang.c
Subject Re: Interesting case that I can't workout!!!!
Date 2023-01-24 12:10 -0800
Organization None to speak of
Message-ID <878rhrelsd.fsf@nosuchdomain.example.com> (permalink)
References <tqnotu$2b1mt$1@paganini.bofh.team> <87lelsea8j.fsf@nosuchdomain.example.com> <tqpd6s$2gdku$1@paganini.bofh.team>

Show all headers | View raw


Jack <invalid@invalid.net> writes:
> On 24/01/2023 06:07, Keith Thompson wrote:
>>
>> If the executable is in your current directory (and you're running it
>> from a command prompt, or from PowerShell, or something similar), it's
>> best to explicitly specify the directory: `.\program` or `.\program.exe`
>> (on a Unix-like system it would be `./program`).
>
> Yes it works by typing .\program but what amazes me is that why other 
> programs in the same folder runs just by typing "program"? What is so 
> special about running shift operator?
>
> The same program compiled using gcc or clang runs like before. It must 
> be something in Visual Studio that stops running the program. I will see 
> if Microsoft developers can verify this. I will post the question on 
> their forum so somebody can try it.
>
> Thanks for the suggestion.

Is the name of the program literally "program"?  When asking for help
with a problem, it's important to show *exactly* what you did.  The
specific name of the executable matters.  For example, if it's
"dir.exe", then typing "dir" will probably run the system's directory
listing command rather than your program; ".\dir" would execute your
program.  If it's "btfsplk.exe", then there probably isn't a system
command with the same name.

When you type "foo" at a command prompt, the system searches your path
(%PATH% on Windows, $PATH on Unix-like systems) for an executable name
"foo" (or "foo.exe" or "foo.bat" et all on Windows).  The current
directory is likely at the *end* of your search path.

It's very likely that your program has a name that happens to match an
existing command, and the system executes that existing command rather
than your program.  You should get into the habit of typing ".\foo"
("./foo" on Unix-like systems) when running a program "foo" in the
current directory.

And you haven't told us how you're executing the program.  cmd.exe?
PowerShell?

-- 
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for XCOM Labs
void Void(void) { Void(); } /* The recursive call of the void */

Back to comp.lang.c | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Interesting case that I can't workout!!!! Jack <invalid@invalid.net> - 2023-01-24 05:00 +0000
  Re: Interesting case that I can't workout!!!! Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-01-23 22:07 -0800
    Re: Interesting case that I can't workout!!!! "Chris M. Thomasson" <chris.m.thomasson.1@gmail.com> - 2023-01-23 22:13 -0800
    Re: Interesting case that I can't workout!!!! Jack <invalid@invalid.net> - 2023-01-24 20:00 +0000
      Re: Interesting case that I can't workout!!!! Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-01-24 12:10 -0800
        Re: Interesting case that I can't workout!!!! Jack <invalid@invalid.net> - 2023-01-24 20:34 +0000
          Re: Interesting case that I can't workout!!!! David Brown <david.brown@hesbynett.no> - 2023-01-24 21:51 +0100
            Re: Interesting case that I can't workout!!!! Jack <invalid@invalid.net> - 2023-01-24 21:21 +0000
              Re: Interesting case that I can't workout!!!! David Brown <david.brown@hesbynett.no> - 2023-01-25 00:09 +0100
          Re: Interesting case that I can't workout!!!! Ike Naar <ike@sdf.org> - 2023-01-24 21:12 +0000
            Re: Interesting case that I can't workout!!!! Jack <invalid@invalid.net> - 2023-01-24 21:28 +0000
              Re: Interesting case that I can't workout!!!! Vir Campestris <vir.campestris@invalid.invalid> - 2023-02-03 20:56 +0000
                Re: Interesting case that I can't workout!!!! gazelle@shell.xmission.com (Kenny McCormack) - 2023-02-03 21:06 +0000
                Re: Interesting case that I can't workout!!!! Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2023-02-03 22:18 +0000
                Andy or Vi{r,c} (Was: Interesting case that I can't workout!!!!) gazelle@shell.xmission.com (Kenny McCormack) - 2023-02-04 00:27 +0000
                Re: Interesting case that I can't workout!!!! Vir Campestris <vir.campestris@invalid.invalid> - 2023-02-06 12:04 +0000
          Re: Interesting case that I can't workout!!!! Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-01-24 13:32 -0800
      Re: Interesting case that I can't workout!!!! Phil Carmody <pc+usenet@asdf.org> - 2023-01-25 13:06 +0200
        Re: Interesting case that I can't workout!!!! Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2023-01-25 11:01 -0800

csiph-web