In the code which you menctioned in 1st post as far as understand
1. in case1 of smenu() first you are asking the user " wish to add more data". if the user selected Y then again u r calling reg(), so that time all your previous data will be lost as the i value will be agian 1.. and it will try to store in std.. so only last record will be saved..
Better to initiliaze the value of 'i' in constructor.. or else instead of saving all the students valus at a time you can save one student details into the file and ask for another student details and save it at that time there is no need to take the array and you can save lot of memory..
2. To read instead of while( toread ) use while ( !toread.eof() ) so that you will know whether the file is reached end of file or not.. otherwise all the time it will be true and will continue forever.. and toread.read((char*)&st,sizeof(student)); is not correct.. as when you read from a file you will get a string.. it won't store in a structure.. so you won't get the correct o/p it seams.. and also here you are using st.. but in dpl() it is member variable std.. which contains last students records not the one which you are reading..