Link to home
Start Free TrialLog in
Avatar of col
col

asked on

terminate input

How do I alter the getline function to terminate input on any one of few possibilities.

e.g.
~~~~.getline(line,LINEMAX,('\n'||'.'||'\t'||"a '/' followed by a space etc etc))

the above simply doesn't work.

Any help?
ASKER CERTIFIED SOLUTION
Avatar of q2guo
q2guo

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of nietod
nietod

that wil work, but you could use strchr() to simplify (and probably speed up) this.

while (i <count)
{
   in.get(&ch);
   if (dems,ch)
   {
      buf[i] = '\0';
      return 1;
   }
   ++i;
   buf[i] = ch;
}

also you realy don't need ch.  I would use the input buffer dirrectly and use a character pointer rather than index buf with [] to speed things up.
Avatar of col

ASKER

Exactly what I was looking for thanks!!