I was trying to create a command line program which first plays a song specified in the argument to the program and then asks the user for point A (startpoint of loop), point B (endpoint) and then infinitely loops between points A and B.

The user would specifiy the points as soon as he hears them. The code for the loop function looks like this (keep in mind that the stream is already playing when the loop function is called).

Note: also I’m unsure on how to get C++ to read just carriage returns from the command line so I sort of hacked the functionality of reading in points A and B by reading in any arbitrary number.

EDIT: Done it! Was using getcurrentposition instead of getposition. The following code does the job: