Help on loading files

So I'm hoping anyone can give an example on how to load .wav files. Say there are several .wav files in a folder called "sounds" in wherever the code is saved in, what would be the steps on loading them in a vector or array. I'm thinking I should use a vector type of array to not worry for a fixed size.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <fstream>
#include <iostream>
#include <vector>
#include <iterator> 
 
int main()
{
    using namespace std;
    const char* Name = "Filename.wav";
    ifstream Input( Name, ios_base::binary );
    if( !Input.is_open() )
    {
        std::cerr << "Cannot read \"" << Name << "\"!";
        return -1;
    }
    vector< char > Data( (istreambuf_iterator< char >( Input )), istreambuf_iterator< char >() );
} 
Last edited on
i have no any Idea.... :(
Topic archived. No new replies allowed.