hello everyone,
i am trying to implement save,load and replay in my chess game made in c++ console.
i am done with save and load but stuck on replay.
i want every turn to be stored in file and when player asks to replay it should show all turns in order they executed
for this i want my read function to act in this way:
-read first 64 characters(total number of components of chess arrary 8*8) and bring them to board array
-then start from 64teh character to 128th character to show next state of game
-then from 128th to next 64 characters and so on

my problem is that is there any function in c++ that allows me to read from file from one point to other point (provided the points are defined by me )..

ask any questions to clarify more..and plz help

Recommended Answers

All 2 Replies

you can check for iostream in c++

Assuming you are using an ifstream to read the file, then function you want is seekg() , which allows you to set the 'get pointer' in a file stream (the point at which the next read will begin). If you follow that link, it has an example of how it is used.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.