#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2003
    Posts
    1
    Rep Power
    0

    How can i ckeck the no of iems of a input file


    if i if i wanna write a program that sort an absolute maximum of 5000 items, print error message if more than 5000 in that file. how can i read that file and check its item....
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Feb 2001
    Posts
    1,481
    Rep Power
    15
    int count = 0;

    while(!inFile.eof())
    {
    inFile>>data;
    count++;
    }
  4. #3
  5. Contributing User
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2003
    Location
    USA
    Posts
    7,255
    Rep Power
    2222
    Are these items of fixed length? If so, then a quick-and-dirty way would be to get the file length and divide it by that fixed length to get the number of items.

IMN logo majestic logo threadwatch logo seochat tools logo