Ask about how to create log file

This is a discussion on Ask about how to create log file within the C++ Programming forums, part of the General Programming Boards category; Now I use Visual C++ 6.0 and I want to create log file which I can write some message in ...

  1. #1
    Registered User
    Join Date
    Jan 2002
    Posts
    68

    Red face Ask about how to create log file

    Now I use Visual C++ 6.0 and I want to create log file which I can write some message in it and after creating that log file cannot edit text in it (not like file .txt which can edit text after creating). Do you know where can I find library or ? If you know how to solve my problem, please tell me.


    Thank you for your kind.

  2. #2
    Registered User
    Join Date
    May 2002
    Posts
    208

    well

    you could just give it a odd file name that wouldn't associate with anything else. your program would still know it is a ASCII file but the other people would have no idea what to assoiate it with.
    Or you could specify it as read only. I am not entirly sure how to do this though. With the first one i suggested it would take either luck or a real smart person to try to open it up in a txt editor. the second one is easyly disabled though
    Jeff Paddon
    Undergraduate Research Assistant
    Physics Department
    St. Francis Xavier University

  3. #3
    I am the worst best coder Quantrizi's Avatar
    Join Date
    Mar 2002
    Posts
    644

    Re: well

    you could just give it a odd file name that wouldn't associate with anything else. your program would still know it is a ASCII file but the other people would have no idea what to assoiate it with.
    True, to some extent.
    Or you could specify it as read only. I am not entirly sure how to do this though. With the first one i suggested it would take either luck or a real smart person to try to open it up in a txt editor. the second one is easyly disabled though
    The first option is still easy to "hack" with. Just double click on the file, and when the "Open With..." box appars, select either Notepad or Wordpad for windows. And if it comes up with stuff with funny little characters, it means it's hard to mess with (unless you use a hex-editor). But if you see readable stuff (like numbers and letters that look right), then it means it is able to be edited. I am not responsible if something happens with anything on your computer if you try my methods, but they are the best way to see if the file is editable.

  4. #4
    Unregistered
    Guest
    You can use this method to set file attributes:

    Code:
    #include <stdlib>
    using std::system;
    
    /*+ sets an attribute
    - clears an attribute
    R read-only file attribute.
    A Archive File attribute.
    S system File attribute
    H hidden file attribute
    /S processes all file in all directories in specified path*/
    
    int main()
    {
      system("attrib +R file.txt");
      return 0;
    }

  5. #5
    Registered User
    Join Date
    Aug 2001
    Posts
    403

    you could write the log into STL strings

    write the log into STL strings, or some odd construct, then you could open a file as binary and save your std::strings into it. You know the contents of the file so you could read it... (or some real weak encryption (check out my xor encryption program here: http://www.cprogramming.com/source/jtxor.cpp)

    you could modify that to meet your own needs

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. sequential file program
    By needhelpbad in forum C Programming
    Replies: 80
    Last Post: 06-08-2008, 01:04 PM
  2. Formatting the contents of a text file
    By dagorsul in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2008, 12:36 PM
  3. Encryption program
    By zeiffelz in forum C Programming
    Replies: 1
    Last Post: 06-15-2005, 03:39 AM
  4. Simple File encryption
    By caroundw5h in forum C Programming
    Replies: 2
    Last Post: 10-13-2004, 10:51 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21