Thread: Need some help

  1. #1
    Registered User
    Join Date
    Aug 2007

    Question Need some help

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

    The code i use is:
    #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");
    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 int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    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.

Popular pages Recent additions subscribe to a feed