Thread: Why do i loose my first character?

  1. #1
    Registered User
    Join Date
    Jan 2002
    Posts
    63

    Why do i loose my first character?

    I'm sure this is simple, but i can't find it so its not dummy simple! lol

    ok i loose the first char, i know i skip the colon, but i don't even think i pull the first char..

    sample input file:

    A : B C D F
    B : A D E G
    C : A D F

    here is the code
    where in is the input file name
    Code:
    while ( in.getlin(buf, BUF_SIZE) && in.good() && !in.eof())
    {
    char *vertname2=strpbrk(buf, " \t");
    *vertname2++ = '\0';
    char *buf2=strpbrk(vertname2, " \t");
    *buf2++ = '/0';
    cout <<buf2<<endl;
    i'm only getting the chars after my colon.. please help!
    SS3X

  2. #2
    Registered User
    Join Date
    Dec 2001
    Posts
    479
    is it getlin or getline?

  3. #3
    Pygmy Monkey ErionD's Avatar
    Join Date
    Feb 2002
    Posts
    408
    It should be getline (i think) but that can't be the prob since you are only loosing your first letter....

  4. #4
    Unregistered
    Guest
    its is getline.. just a typo... but why the loss of chars?

  5. #5
    Registered User
    Join Date
    Dec 2001
    Posts
    479
    it would be easier if u posted some more code or the entire code
    so we have a clue on what we are dealing with

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. sorting number
    By Leslie in forum C Programming
    Replies: 8
    Last Post: 05-20-2009, 04:23 AM
  2. Character literals incorrectly interpreted
    By DL1 in forum C Programming
    Replies: 11
    Last Post: 04-05-2009, 05:35 PM
  3. <string> to LPCSTR? Also, character encoding: UNICODE vs ?
    By Kurisu33 in forum C++ Programming
    Replies: 7
    Last Post: 10-09-2006, 12:48 AM
  4. Character handling help
    By vandalay in forum C Programming
    Replies: 18
    Last Post: 03-29-2004, 05:32 PM
  5. UNICODE and GET_STATE
    By Registered in forum C++ Programming
    Replies: 1
    Last Post: 07-15-2002, 03:23 PM