Thread: how can i get the stream size?

  1. #1
    Registered User
    Join Date
    Aug 2013
    Posts
    451

    how can i get the stream size?

    i have 1 structure file with int, string and image members.
    i had overloading the << and >> stream operators on it and on image too.
    on image i'm trying getting the stream size.
    but before continue i need 1 correction:
    Code:
    friend std::istream& operator >> (std::istream& lhs, image& rhs)
    the istream::seekg() changes the entire file position, or the actual stream position?

  2. #2
    Registered User
    Join Date
    Sep 2015
    Posts
    31
    seekg() to the end, then tellg(), then seekg() to the beginning.

    For particular data..
    v1 = tellg(), then read..process, then v2 = tellg(). size = v2 - v1
    Last edited by billboardplus; 08-07-2016 at 12:34 PM.

  3. #3
    Registered User
    Join Date
    Aug 2013
    Posts
    451
    imagine that the image is part of a file? that way will working?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. What is a stream? What really is a stream object?
    By Ramcin Oudishu in forum C++ Programming
    Replies: 3
    Last Post: 04-18-2014, 01:33 PM
  2. Size of fixed size object?
    By shwetha_siddu in forum C Programming
    Replies: 2
    Last Post: 04-08-2009, 02:39 AM
  3. Finding Words in a array[size][size]
    By ^DJ_Link^ in forum C Programming
    Replies: 8
    Last Post: 03-08-2006, 03:51 PM
  4. Help! About text stream and binary stream
    By Antigloss in forum C Programming
    Replies: 1
    Last Post: 09-01-2005, 08:40 AM
  5. window size VS. pixel size
    By dug in forum Windows Programming
    Replies: 2
    Last Post: 08-26-2003, 06:30 AM

Tags for this Thread