I have a problem! after reading strings from a file (with ReadString want), I overwrite certain strings with new ones. WriteString The write command is ignored. Who can help?
do you have to file as CFile:: modeRead only open maybe?? need to write CFile:: Write mode | CFile:: modeCreate if it does not exist! Code: CStdioFile f; CString m_LogFileName = " File.log "; if (f.Open (m_LogFileName, CFile:: Write mode) == FALSE) ( if (f.Open (m_LogFileName, CFile:: modeCreate | CFile:: Write mode) == TRUE) ( f.WriteString (cstrZeit + "" + cstrZeile + ' \ n ') f.close (); ) ) else ( f.SeekToEnd (); / / f.WriteString ("####### ############################## \ n "); f.WriteString (cstrZeit + "" + cstrZeile + ' \ n ' ) f.close (); )
No, it did with "Mitarbeiter_File.Open (file_name, CFile:: modeReadWrite) opens. Detailed problem description: This is a password check. 4 * If the employee has entered the wrong password, the file will be overwritten the saved password in by a "special password, a log again in general (the correct password) to stop using it.
Then you must close it and open it with write mode and enter your new car as I have it above hingepostet. Because the file exists, can you query with the CFile:: Write mode | CFile:: modeCreate also pay.
How can I then overwrite the old password? That is, how do I get to the point where the old password is? Your method makes it but I believe only one adding the new password at end of file, right?
you have to read through the text until you have found the old password. then you realize you the places and replaces the old password just by the new!
How can you remember the place (will surely be sought in read-mode right?)? How can we get there in write mode? Why is there a mode modeReadWrite "if you only close the file and write mode has to re-open with?
If you a certain position in the file write off will overwrite the existing and not supplements! That is only if your new password length is just like your old or length for you to store the password you provided a solid, everything is ok.