I'm currently working on a bomberman game :D. Its going on pretty damn well honestly. I'm now creating my map editor but I would like to know if its possible to move throught a .txt file using an out stream ? I have already learned how to read using a buffer (String)
while (courant2 != NULL) //I EST LA HAUTEUR
{
courant1=courant2;
LeVectorPosition.x = 0;
while (courant1 != NULL) //J EST LA LONGEUR
{
Fichier >> buffer;
As you can see, I use this buffer to move around each word and I was suprise when I saw that it moved over space by itself. Now though, I want to move inside my .txt file to then change a tile.
0,0-N 0,0-N 0,0-N 0,0-N 0,0-N 0,0-N 0,0-N 0,0-N 0,0-N 0,0-N 0,0-N 0,0-N 0,1-Y 0,1-N
0,0-N 0,0-N 0,0-N 0,0-N 0,0-N 0,0-N 0,0-N 0,0-N 0,0-N 0,0-N 0,0-N 0,0-N 0,1-Y 0,1-N
0,0-N 0,0-N 0,0-N 0,0-N 0,0-N 0,0-N 0,0-N 0,0-N 0,0-N 0,0-N 0,0-N 0,0-N 0,1-Y 0,1-N
0,0-N 0,0-N 0,0-N 0,0-N 0,0-N 0,0-N 0,0-N 0,0-N 0,0-N 0,0-N 0,0-N 0,0-N 0,1-Y 0,1-N
0,0-N 0,0-N 0,0-N 0,0-N 0,0-N 0,0-N 0,0-N 0,0-N 0,0-N 0,0-N 0,0-N 0,0-N 0,1-Y 0,1-N
0,0-N 0,0-N 0,0-N 0,0-N 0,0-N 0,0-N 0,0-N 0,0-N 0,0-N 0,0-N 0,0-N 0,0-N 0,1-Y 0,1-N
Would someone mind explaining to me the basic of moving and using an Ostream ? It would be really appreciate. Thank you and sorry for my miserable english XD.
You can use
ostream::seekp
to move the stream position backward or forward, as described here