Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


File >> Edit Control

This topic is 5886 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am having trouble with my encryption program/text editor (win32) -- I can''t load files. I take that back -- I *could* load files, but only plaintext files (and my App was originally intended for encryption). I had intended to do everything in this order--- 1.) Create App w/ edit box and the various controls needed (optional encryption, save, load, saveas.... (done) 2.) Implement plaintext file saving (messed up) 3.) Implement encrypted file saving (messed up) 4.) Load plaintext file (scrapped and re-building) 5.) Load encrypted file (screwed all saving to hell) What happened was (after I had finished all but 5), I forgot that I needed some sort of signature at the beginning of a file that would tell me if it was encrypted or not (I have not yet implemented keys or passwords -- i''ll do that once i''m done with what I already have on my plate). So, I went to the saving algorithm (which took all of the info in the main edit box and put it into a char*, which was written to file by an ofstream object [fstream.h]...) and added a char* that would, when the user allowed file encryption, add an extra line of text at the beginning of the file. So, I strcat-ed the edit-text to the extra line, deleted the edit-text char*, then made edit-text the same as the extra line (which by now contained the extra line + all of the text in the edit), then wrote it to file. I think that somewhere along the way, my pointers got screwed up (I HATE F***ING POINTERS!!!) by either me deleting one of them or making one of the a ''new char[x]'' or the like.
    // actual source for save

    // save_file is a char* for the filename

    // hwnd_txt is the HWND of the main edit

    int linelen = 0;
    char* linebuff;
    char* xz;
    ofstream fout;
    linelen = SendMessage(hwnd_txt,WM_GETTEXTLENGTH,(WPARAM)0, (LPARAM)0);
    linebuff = new char[linelen];
    SendMessage(hwnd_txt, WM_GETTEXT, (WPARAM)linelen,  (LPARAM)linebuff);
        xz = "#ency\n";
        int i = 0;
        for(i = 0; i != strlen(linebuff); i++)
            linebuff[i] += 13;
        strcat(xz, linebuff);		

fout << xz;
Why don''''t we just kill the guys who write annoying, useless warning messages. It''''d make our lives a hell of a lot easier

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!