Thread: Prevent access (FILES)

  1. #31
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    So, you manually copy your file to the new location, then supply that path to your file when you open it in your app, e.g.
    Code:
    FILE *f = fopen("c:\\mydirectory\myfile.txt", "r");
    I would definitely advice that you do NOT put files in c:\windows unless you have a very good argument for why they should be there - and no, "my highscore file is more difficult to find if it's in c:\windows" is not a good argument here [even if the above is indeed true].

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  2. #32
    Registered User gavra's Avatar
    Join Date
    Jun 2008
    Posts
    265
    Don't worry I will not, just "C:\\".
    Thank you again [:

    I have noticed my compiler needs "\\" not just "\" (maybe cause "\n" "\b"...?)
    gavra.

  3. #33
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by gavra View Post
    I have noticed my compiler needs "\\" not just "\" (maybe cause "\n" "\b"...?)
    Indeed.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  4. #34
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Quote Originally Posted by gavra View Post
    I have noticed my compiler needs "\\" not just "\" (maybe cause "\n" "\b"...?)
    Exactly - one \ means that the next character is "special" (although if it's not one of the "known special", then it just translates to itself, so \m would translate to m). So to make one backslash, you need two of them.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

  5. #35
    Registered User gavra's Avatar
    Join Date
    Jun 2008
    Posts
    265
    I like this word XD
    And ok as I thought.. thanks.
    gavra.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Random Access Files...ugh.
    By equss89 in forum C Programming
    Replies: 5
    Last Post: 07-21-2008, 02:25 PM
  2. I Need To Know Some Things That I Can Put Into A Batch File
    By TheRealNapster in forum A Brief History of Cprogramming.com
    Replies: 1
    Last Post: 10-20-2003, 08:12 PM
  3. How to Access a Function from Multiple Files?
    By Unregistered in forum C++ Programming
    Replies: 7
    Last Post: 06-08-2002, 06:24 PM
  4. Using c++ standards
    By subdene in forum C++ Programming
    Replies: 4
    Last Post: 06-06-2002, 09:15 AM
  5. Random Access Files
    By Unregistered in forum C Programming
    Replies: 1
    Last Post: 08-29-2001, 08:06 AM