If you debug your program, you can see your "getline" reads the string starting from where you finished writing your string back to the file. That means your write process does change the read pointer.
I think you can check if you still get the problem if you omit those write statements.
Although I am not sure, It seems like your seekp() changes the file pointer and you don't handle it back properly. I don't know whether you have moved the pointer to the next line or not after you put something to the current line of your file.
Why don't you set a CStatic control in the dialog? then whenever you want to display your mark, you just need to write it into your CStatic control. It is much simpler.
change sin >> SlNames[0]; to
sin << m_Name1;
sin << m_Name2;
sin << m_Name3;
sin << m_Name4;
sin << m_Name5;
Another alternative to this method is to save your variables into windows registry.
look at WriteProfileString and ReadProfileString...
in the project workspace (usally it is at the left pane of your VC++ studio). Click the "ClassView" tab , you can see a list of the classes in your project. Then right click the class you want, a menu is popped up . Select the menu item of "Add Member Function ...". That's it.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.