Jump to content
  • Advertisement

5dollarshake

Member
  • Content Count

    5
  • Joined

  • Last visited

Community Reputation

100 Neutral

About 5dollarshake

  • Rank
    Newbie
  1. 5dollarshake

    Ifstream problems - Programming Games AI by Example

    Yes, that is exactly what is happening. The C++ standard library provides overloaded [font="Courier New"]std::operator>>(std::istream&, T)[/font] and [font="Courier New"]std::operator<<(std::ostream&, T)[/font] for various types T, and uses those overloaded operators to perform formatted input and output respectively. This use of overload bitshift operators as formatting functions first appeared about 1991. The bitshift operators were chosen because (a) they're used infrequently and (2) they have a very low (although not the lowest) operator precedence. These operators are a part of the standard library that makes up an ISO-compliant C++ development environment. You should get familiar with them. [/quote] Ahh brilliant, thank you, I will look into it.
  2. 5dollarshake

    Ifstream problems - Programming Games AI by Example

    Sorry, just posted this three times! It was coming up with some crazy SQL error so I thought it hadn't posted it!
  3. Hello, I am new here! I was just working through the "Programming Games AI by Example" book, trying to understand how a file was being loaded using ifstream. After debugging for ages, I can't understand how the variable NumNodes is being set to the number on the first line of the .map file. It is like the ">>" operator is being overloaded or some other technique that I have never come across before. Anyone know what could be happening here please? Any help would be greatly appreciated, cheers! [sourcelang="cpp"]template <class node_type, class edge_type> bool SparseGraph<node_type, edge_type>::Load(std::ifstream& stream) { Clear(); //get the number of nodes and read them in int NumNodes, NumEdges; stream >> NumNodes; .... }[/source]
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!