TIP: Click on subject to list as thread! ANSI
echo: c_plusplus
to: BRIAN WOOD
from: HERBERT BUSHONG
date: 1998-01-22 13:44:00
subject: `/a`=?

First off Brian,
  '/a'  is not valid. The differences in compilers you are see is the 
ompiler
attempting to work with your mistake. Single quotes are use to surround 
single characters (normal or escaped):  '/', 'a', '\0', '\x0D', etc...
::> example command line:
::>         C:\THISPROG.EXE /a
::> while (--argc && **argv++) {
::>          // case '/a': isn't evaluated consistently
::>          // Best way around this?
::>          cout << "\narg entered was " << endl;
::>          switch (*(int*) *argv) {
::>              case '/a':
::>                  cout << "/a" << endl;
::>              break;
::>          default:
::>              cout << *argv << " (unknown)" << endl;
::>              break;
::>          }
::> }
int parms = argc - 1;
char *ptr = argv[parms];
   while (parms-- && ptr)
      {
        cout << "arg entered was: "
        if (ptr == '/')
        {
           switch (++ptr)
           {
               case 'a':
               case 'A':  cout << "/a" << endl; break;
               default:   cout << (--ptr) << "(unknown)" << endl;
           }
         }
         else
            cout << ptr << "(unknown unswitched)" << endl;
         ptr = argv[parms];
      }
#  Herbert Bushong    harchon@centuryinter.net       [TEAM OS/2]    
-  Blackbeard's BBS   Intelec: 239:600/0            
+  Fido: 1:19/19      http://www.intelec.com/software/
---
   RM 1.31 2508   Greed is the Walton's having another child
---------------
* Origin: Blackbeard's BBS - Ville Platte, LA - 318-468-3385 (1:19/19)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.