Results 1 to 3 of 3

Thread: char to int

Threaded View

  1. #1

    Thread Starter
    Member
    Join Date
    Aug 2000
    Posts
    54
    i'm doin an ifstream .get() to pull in characters from a text file.
    and the last character it pulls out a number. I want to return an int value.

    Heres the code maybe i'm doing something wrong..

    int get_version_num()
    {
    ifstream din;
    do
    {
    din.get(ltr);
    cout<< ltr;
    if(ltr=='V')
    qans++;
    if(ltr=='R')
    qans++;
    if(ltr=='M')
    qans++;
    }
    while(qans<4);

    do
    {
    din.get(ltr);
    i++;
    }
    while(i<5);

    answ = ltr;
    return ltr;
    }
    Last edited by Flamer; Mar 7th, 2001 at 12:11 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width