Need some help

This is a discussion on Need some help within the C++ Programming forums, part of the General Programming Boards category; Im new to programming and trying to copy a file from My Documents To C. The code i use is: ...

  1. #1
    Registered User
    Join Date
    Aug 2007
    Posts
    19

    Question Need some help

    Im new to programming and trying to copy a file from My Documents To C.

    The code i use is:
    Code:
    #include <windows.h>
    #include <iostream>
    
    using namespace std;
    
    int main(){
        system("title copy1");
    
    MessageBox(NULL, "Copy","Press OK To Start Copy", MB_ICONEXCLAMATION | MB_OK);
    system("copy C:\\Documents and Settings\\me\\Mine dokumenter\\test.txt C:\\test.txt");
         cin.get();
              }
    The main problem is the spaces in "Documents and settings" anyone know how to get past that
    im using windows xp/dev-c++
    and for some reason the opposite /'s are shown as W here
    Last edited by dumazz; 08-01-2007 at 07:00 AM.

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,546
    Say
    Code:
    system("copy \"C:\\Documents and Settings\\me\\Mine dokumenter\\test.txt\" C:\\test.txt");
    Though if you're going to use so many system() calls, you may as well write it as a batch file.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

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