Hi, I was wondering how to read from files in c++ in a way that lets me know if there are any problems. I need this because when I load somthing like a level file, if the file isn't exactly right I want it to know and stop instead of carrying on and doing somthing upredictable.

I used to use sscanf in c like this.
Code:
char buffer[100];
int x, y;

fgets(buffer,sizeof(buffer),fp);

if (sscanf(buffer, "x: %d, y: %d", &x, &y) < 2)
    printf("Woops\n");
What is the best way to do this in c++? Thanks