home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.c      Meh, in C you gotta define EVERYTHING      243,242 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 242,680 of 243,242   
   bart to And previously I'd   
   Re: srand(0)   
   01 Jan 26 14:05:29   
   
   From: bc@freeuk.com   
      
   On 01/01/2026 01:03, Lawrence D’Oliveiro wrote:   
   > On Wed, 31 Dec 2025 22:57:55 +0000, bart wrote:   
   >   
   >> But, there is a difference between argv[0] and GetModuleFileName().   
   >   
   > So the latter cannot be used as a simple substitute for the former, as   
   > you might have led us to believe.   
      
      
   It depends on your needs. If you need to know exactly what was typed,   
   then you use GetCommandLine and extract the first part of it.   
      
   Or you just use __getmainargs. Or argv[0] if available.   
      
   However, I was responding to this:   
      
   LD'O:   
    >In fact, it is quite common for utilities to behave differently based   
   on the name, as passed in argv[0], by which they are invoked.   
      
   And previously I'd said this:   
      
    >(And on Windows, if it is 0 and you really need the path, you can get   
   it with GetModuleFileNameA().)   
      
   At that point I'd forgotten that GetModuleFileName gives you more   
   information than argv[0], so you'd to extract it. But you'd have to do   
   that anyway to clean up the input: somebody may have typed   
   c:\abc\.\.\.\.\.\ProG   
      
   So I wasn't misleading anybody.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca