Which line of code is throwing Access Violation? I guess it's the glReadPixels line.
My guess is that you must lock surface before writting pixels using SDL_LockSurface