I am trying to get music to loop in the background of a game. However im really not sure how to do this. Can anyone give me a starting point please? I am using Visual C++ btw.

If you are on windows, then you can use PlaySound . If not then there might be something similar to your
OS. If all fails, you will have to use a 3rd party library.

I got this piece of code

#include <stdio.h>
#include <stdlib.h>
#include <Windows.h>

#pragma comment(lib,"Winmm.lib")

int main(void)

	return 0;

But it will only play at the begining of the program where i want it to loop- how can i do this?

I got it to work by using this code


Thanks for your help