problem

This is a discussion on problem within the C++ Programming forums, part of the General Programming Boards category; ive been trying to get my program to work all day parameter 3 on CopyFile is the problem i think ...

  1. #1
    Banned
    Join Date
    Oct 2004
    Posts
    250

    problem

    ive been trying to get my program to work all day parameter 3 on CopyFile is the problem i think
    Code:
    #include <iostream>
    #include <windows.h>
    #include <cstring>
    
    using namespace std;
    int main()
    {
    	for(int i=0;i<2;i++)
    	{
    		char buffer[50];
    		itoa(i,buffer,10);
    		strcat(buffer,".exe");
    		CopyFile("Install1.exe",buffer,0);
    	}
    }

  2. #2
    Super Moderator
    Join Date
    Sep 2001
    Posts
    4,913
    In future, be a lot more specific, both in your subject line, and in what exactly the problem is. Look up the copyfile function on MSDN (http://msdn.microsoft.com/library/de...e/copyfile.asp). That should clarify your confusion about the parameters.

  3. #3
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    >> parameter 3 on CopyFile is the problem i think

    the first thing you need to do is find a good reference. "If this parameter is FALSE and the new file already exists, the function overwrites the existing file and succeeds". my guess is that the current directory is not set to the directory you have the original file.

    [edit]
    beat me to it
    [/edit]
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  4. #4
    Registered User
    Join Date
    Nov 2004
    Location
    Pennsylvania
    Posts
    434
    Another problem i had once with the strcat() command, if the char isn't defined yet sometimes the strcat works and sometimes it doesn't try using strcpy(). I hope this helps!

  5. #5
    Banned
    Join Date
    Oct 2004
    Posts
    250
    Do you know of any good references that i can look up functions as i need them?

  6. #6
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,558
    http://msdn.microsoft.com for all things win32 API
    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.

  7. #7
    Registered User
    Join Date
    Sep 2004
    Posts
    719
    google
    i seem to have GCC 3.3.4
    But how do i start it?
    I dont have a menu for it or anything.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help understanding a problem
    By dnguyen1022 in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2009, 04:21 PM
  2. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 10:22 AM
  3. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  4. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  5. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM

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