Thread: File copy

Results 1 to 6 of 6
  1. #1
    .::SCHiM::.'s Avatar
    Join Date
    Sep 2010
    Gender
    male
    Posts
    733
    Reputation
    180
    Thanks
    880
    My Mood
    Twisted

    File copy

    I'm creating an application for sorting text documents based on their contents.
    The ap works like this: I have a folder where the files I want sorted are, I supply parameters for my filter, and then a path where I want the appropriate file copied to (say I want to sort for the letter 'a', my ap seeks the right file, and then copies it to the given result dir)

    But I've come accros problems, The position of the files to sort is hard-coded, but the result location isn't, it's a string that the user supplies.

    Say that I want to list the results here:

    "C:\TESTMAP\Testing map folder\sometxt.txt"

    The problem is, every time I give my program a string:

    C:\TESTMAP\Testing map folder\sometxt.txt

    The program doesn't copy anything, after some error checking I see that windows shoves an error 123 (ERROR_INVALID_NAME, aka: The filename, directory name, or volume label syntax is incorrect)

    What's going wrong?

    I'm SCHiM

    Morals derive from the instinct to survive. Moral behavior is survival behavior above the individual level.

    Polymorphic engine
    Interprocess callback class
    SIN
    Infinite-precision arithmetic
    Hooking dynamic linkage
    (sloppy)Kernel mode Disassembler!!!

    Semi debugger




  2. #2
    Void's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Location
    Inline.
    Posts
    3,198
    Reputation
    205
    Thanks
    1,445
    My Mood
    Mellow
    Put 2 backslashes:

    C:\\TESTMAP\\Testing map folder\\sometxt.txt

    If there are any spaces in the path, like the one you posted, you have to add quotes, meaning quotes in a quote. To put a quote in a quote just use add a backslash before the quote character.

    [php]
    char* szPath = "\"C:\\TESTMAP\\Testing map folder\\sometxt.txt\"";
    [/php]

  3. #3
    freedompeace's Avatar
    Join Date
    Jul 2010
    Gender
    female
    Posts
    3,033
    Reputation
    340
    Thanks
    2,792
    My Mood
    Sad
    In addition to Void's statement, go read up on escape characters in C++ (or C#).

  4. #4
    .::SCHiM::.'s Avatar
    Join Date
    Sep 2010
    Gender
    male
    Posts
    733
    Reputation
    180
    Thanks
    880
    My Mood
    Twisted
    No those weren't the problems, but I fixed them already on my own
    (I was unable to reach mpgh the last couple of days, so that's for my late response)

    I'm SCHiM

    Morals derive from the instinct to survive. Moral behavior is survival behavior above the individual level.

    Polymorphic engine
    Interprocess callback class
    SIN
    Infinite-precision arithmetic
    Hooking dynamic linkage
    (sloppy)Kernel mode Disassembler!!!

    Semi debugger




  5. #5
    Void's Avatar
    Join Date
    Sep 2009
    Gender
    male
    Location
    Inline.
    Posts
    3,198
    Reputation
    205
    Thanks
    1,445
    My Mood
    Mellow
    Quote Originally Posted by .::SCHiM::. View Post
    No those weren't the problems, but I fixed them already on my own
    (I was unable to reach mpgh the last couple of days, so that's for my late response)
    Share solution please. |:

  6. #6
    .::SCHiM::.'s Avatar
    Join Date
    Sep 2010
    Gender
    male
    Posts
    733
    Reputation
    180
    Thanks
    880
    My Mood
    Twisted
    Quote Originally Posted by Void View Post
    Share solution please. |:
    Well it was verry stupid actually , in my days of C++ noobyness I tended to use cin >> to get every imput I needed, but cin >> only receives imput until the next delimiter symbol is found (in this case a space) so when imputing a path with a space in it, my program would fail

    So now I use getline(cin, buffer);

    I'm SCHiM

    Morals derive from the instinct to survive. Moral behavior is survival behavior above the individual level.

    Polymorphic engine
    Interprocess callback class
    SIN
    Infinite-precision arithmetic
    Hooking dynamic linkage
    (sloppy)Kernel mode Disassembler!!!

    Semi debugger




  7. The Following User Says Thank You to .::SCHiM::. For This Useful Post:

    Hell_Demon (09-19-2010)

Similar Threads

  1. [Help]Copy and replacing files
    By nathanael890 in forum Visual Basic Programming
    Replies: 20
    Last Post: 04-05-2010, 04:05 PM
  2. CANT COPY DLL FILES FROM NEW WALLHACK!
    By beroman in forum CrossFire Hacks & Cheats
    Replies: 27
    Last Post: 01-05-2010, 09:55 AM
  3. [Release] Mpgh Rez File-copy tool[Updated]
    By Zoom in forum Combat Arms Mods & Rez Modding
    Replies: 2
    Last Post: 12-13-2009, 09:53 AM
  4. [help]Error copying files cshell.dll.
    By mexicano007 in forum Combat Arms Mods & Rez Modding
    Replies: 12
    Last Post: 12-09-2009, 04:24 PM
  5. List of .rez Files where we can copy Game Files from!
    By Stephen in forum Combat Arms Mod Discussion
    Replies: 4
    Last Post: 12-04-2009, 02:46 PM