I have used the above code to write the class instance to a file "Text.txt"... But it seems that "f.write((char*)&c, sizeof(CLS));" is not working properly with string. The data can easily be written using stream object!! Please someone tell me what's the problem and how can I correct it 'coz I require this type of codes for my Project also!!