how to read pixels from screen and save to memory

can anyone show a sample how to read pixels from screen and save to memory?

Sure you can. Use glReadPixels(). Just take a look to a specification (somewhere on this site, or google) - everything is explained and using this command is very simple.