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

 HB> '/a'  is not valid. The differences in compilers you are see is the
 HB> compiler attempting to work with your mistake.
Yeah, that's why I'm asking the question.  Thanks for the code!  With a
couple of corrections it works, though it gets the args in reverse
order.  Shouldn't be too hard to work with.
 HB> int parms = argc - 1;
 HB> char *ptr = argv[parms];
 HB> while (parms-- && ptr)
 HB> {
 HB>    cout << "arg entered was: "
 HB>    if (ptr == '/')      // (*ptr=='/') is correct
 HB>    {
 HB>       switch (++ptr)    // switch(*(++ptr)) is correct
 HB>       {
 HB>          case 'a':
 HB>          case 'A':  cout << "/a" << endl; break;
 HB>          default:   cout << (--ptr) << "(unknown)" << endl;
 HB>       }
 HB>    }
 HB>    else
 HB>    cout << ptr << "(unknown unswitched)" << endl;
 HB>    ptr = argv[parms];
 HB> }
L8r,
bw
... Every time I have all the answers, someone changes the questions!
--- Blue Wave/DOS v2.20
---------------
* Origin: River Canyon Rd. BBS Chattanooga, Tn (1:362/627)

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™.