I’m working on a simpel FMOD wrapper class for a small game project and i have a little problem with a specific function in fmod.
[code:ngqv9vxy]FMOD_RESULT F_API getName (char *name, int namelen);
I try to use this function to get the name of a sound in a std::vector<FMOD::Sound*> like this:
[code:ngqv9vxy]char* myFileName = 0;
I wonder why i don’t get the name of the sound file and what the second argument in getName "int namelen" is.
Please help =)
- Kililae asked 8 years ago
getName() copies the name of the Sound into a buffer that you provide. You can’t just give it a pointer to a char, you have to give it the head of a char array. But because it’s an array of characters, you have to tell FMOD how many characters you have.
The proper usage is something like:
[code:2fq9cvik]const int FILENAME_LENGTH = 32; // Or some other number, pick whatever seems appropriate.
Hope that helps!
- Adiss answered 8 years ago
Please login first to submit.