-
Fstream. I/O
Hello, i am having some trouble with Fstream. I did not study fstream but im studying now.
Since im making a 2d Engine in sdl, I'm trying to find out how the files will actually load...i have found out how...here's how i will do it.
Let's say for music.
I write to a Music.txt file.
Then, i write the number "MusicLocation"
let's say...
1 "Music.mp3"
2 "Music.mp3"
Now, fstream will read the numbers and save them into the music array, then i will make Sdl load all the musics from this array. The sdl part, im doing it myself, it's easy...but i'm really not comfortable with fstream.
If i can get any help from you, that'll be a pleasure.
I need fstream to read the number and the location. The number will save into the array.
1 "Music1.mp3" <-- This music will save into Music[1] Actually, "Music1.mp3" will save into Music[1] not the number.But the number tells Music1.mp3 where to save. I need a find function.
2 "Music2.mp3" <-- This music will save into Music[2]
Thank you.
-
If you're not comfortable with C++ file streams, you probably are not ready to write a 2D game engine.
Either way, you need a way to know how to load all your music files. What you could do is have an ini or xml file that lists all of the music files and what order they should be loaded in. Otherwise, you'll have to scan the entire directory and parse the names yourself, and that is not a portable option in the C++ standard library.
-
Yes, i am ready to write one, i am writing one currently and stuff are working great... i just need to know how fstream works. Then, i could make the good stuff, such as Tile map editor,...