Thread: Reconstructing a vector saved in a binary file..

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User hk_mp5kpdw's Avatar
    Join Date
    Jan 2002
    Location
    Northern Virginia/Washington DC Metropolitan Area
    Posts
    3,817
    What do your employee objects look like data-members-wise? Unless they are strictly POD you are going to have issues writting/reading to/from a file like you are attempting.
    "Owners of dogs will have noticed that, if you provide them with food and water and shelter and affection, they will think you are god. Whereas owners of cats are compelled to realize that, if you provide them with food and water and shelter and affection, they draw the conclusion that they are gods."
    -Christopher Hitchens

  2. #2
    Absent Minded Programmer
    Join Date
    May 2005
    Posts
    968
    Like this?

    Code:
    class employee
    {
    public:
    	employee(std::string, float);
    	const std::string& get_name();
    	const float& get_payrate();
    	const std::string& get_gender();
    	const std::string& get_startdate();
    	const std::string& get_enddate();
    
    	void set_name(std::string);
    	void set_payrate(float);
    	void set_gender(std::string);
    	void set_startdate(std::string);
    	void set_enddate(std::string);
    private:
    	std::string name;
    	float payrate;
    	std::string gender;
    	std::string startdate;
    	std::string enddate;
    	bool active;
    };
    Sometimes I forget what I am doing when I enter a room, actually, quite often.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. bad characters in excel saved CSV file
    By rogster001 in forum C++ Programming
    Replies: 11
    Last Post: 05-27-2011, 09:59 AM
  2. Scoreboard saved in .txt file?
    By Newklear in forum C Programming
    Replies: 14
    Last Post: 03-21-2011, 08:06 PM
  3. Writing contents of an std::vector to a binary file! ;o)
    By shrink_tubing in forum C++ Programming
    Replies: 7
    Last Post: 08-22-2010, 06:32 AM
  4. Location of Saved File
    By loopshot in forum C++ Programming
    Replies: 13
    Last Post: 01-22-2006, 11:26 PM
  5. reading saved file
    By firefly in forum C++ Programming
    Replies: 1
    Last Post: 07-09-2005, 01:24 AM