Thread: File loading

  1. #1
    Flash Animator, OF DOOOOM bluehead's Avatar
    Join Date
    Nov 2001
    Posts
    269

    File loading

    Is there a way to open a file.........for example

    Your .exe file is in:

    C:\blah\exefile\blah.exe

    and u want a .txt file in

    C:\blah\txtfiles\blah.txt

    is there a way to open blah.txt.... or do they both have to be in the same directory?
    Code:
    #if _emo
      #define stereo_type_i_dislike
    #endif

  2. #2
    Flash Animator, OF DOOOOM bluehead's Avatar
    Join Date
    Nov 2001
    Posts
    269

    By the way....

    How can i make it so the .txt file or my information file isn't editable by notepad?
    Code:
    #if _emo
      #define stereo_type_i_dislike
    #endif

  3. #3
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    Either use an exact path like "C:\blah\exefile\blah.exe" or do a relative path like "..\exefile\blah.exe"
    (the .. goes "backwards" in the folder tree one step)
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  4. #4
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145

    Re: By the way....

    Originally posted by bluehead
    How can i make it so the .txt file or my information file isn't editable by notepad?
    All files are editable by notepad (even binary files, though it can be hard to do it ). To make a text file unreadable you have to use some kind of encryption.
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  5. #5
    Flash Animator, OF DOOOOM bluehead's Avatar
    Join Date
    Nov 2001
    Posts
    269
    uhhhhh i hope thats not hard to do....... how do i do it?
    Code:
    #if _emo
      #define stereo_type_i_dislike
    #endif

  6. #6
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    I'm no expert on encryption, sorry.
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  7. #7
    Bluehead69
    Guest
    o, well, ne1 else here know?

  8. #8
    Registered User moi's Avatar
    Join Date
    Jul 2002
    Posts
    946

    Re: File loading

    Originally posted by bluehead
    Is there a way to open a file.........for example

    Your .exe file is in:

    C:\blah\exefile\blah.exe

    and u want a .txt file in

    C:\blah\txtfiles\blah.txt

    is there a way to open blah.txt.... or do they both have to be in the same directory?
    FILE *textfile = fopen ("..\\txtfiles\\blah.txt", "rt");
    hello, internet!

  9. #9
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145
    Originally posted by Bluehead69
    o, well, ne1 else here know?

    You could do a very simple encryption, like moving the ASCII values of the characters two steps to the right (A turns to C, B turns to D etc...). Hello world turns to Jgnnq yqtnf. These are easy to solve though...
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

  10. #10
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793

    Re: By the way....

    Originally posted by bluehead
    How can i make it so the .txt file or my information file isn't editable by notepad?
    Dont use a text file......record the data in the registry if its not too much

  11. #11
    Confused Magos's Avatar
    Join Date
    Sep 2001
    Location
    Sweden
    Posts
    3,145

    Re: Re: By the way....

    Originally posted by Fordy


    Dont use a text file......record the data in the registry if its not too much
    Lots of people know how to edit the registry keys, so it won't be a perfect solution. Better than nothing though...
    MagosX.com

    Give a man a fish and you feed him for a day.
    Teach a man to fish and you feed him for a lifetime.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. To find the memory leaks without using any tools
    By asadullah in forum C Programming
    Replies: 2
    Last Post: 05-12-2008, 07:54 AM
  2. gcc link external library
    By spank in forum C Programming
    Replies: 6
    Last Post: 08-08-2007, 03:44 PM
  3. Replies: 3
    Last Post: 03-04-2005, 02:46 PM
  4. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM
  5. archive format
    By Nor in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 08-05-2003, 07:01 PM