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.
add a method SendGet(inMsg, outMsg)to your modeless dialog . Pass the pointer of the modeless dialog(pModalessDlg) to the constructor of your modal dialog. When you want to send and get messages to and from the modaless dialog, just call pModalessDlg->SendGet(inMsg,outMsg).
a sample code:
bool validateString(char * aStr)
{
int n = strlen(aStr);
if (n > 10 ) return 0;
for (int i=0; i< n ; i++)
if (!isalpha(aStr[i])) return 0;
return 1;
}
I used to work on the constraint satisfaction problem.
Basically CSP deals with a set of finite domain(mostly integer) variables, there are a few constraints on the variables. Solveing a CSP is to find values for every variable so that every constraint will be met.
The problem here is a...
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.