Thread: self copying

  1. #1
    Banned
    Join Date
    Oct 2004
    Posts
    250

    self copying

    how can you make a file copy itself?

  2. #2
    Registered User MathFan's Avatar
    Join Date
    Apr 2002
    Posts
    190
    u mean an exe-file?
    The OS requirements were Windows Vista Ultimate or better, so we used Linux.

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Or like a virus - who knows.
    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.

  4. #4
    Banned
    Join Date
    Oct 2004
    Posts
    250
    a TXT file but it would be handly if i knew how to copy a .exe file

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    You mean like from the command prompt

    copy c:\from\here.txt c:\to\there.txt
    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.

  6. #6
    Banned
    Join Date
    Oct 2004
    Posts
    250
    no i want a program to automatically copy itself a certain amount of times when ran is there anyway to do that?

  7. #7
    Toaster Zach L.'s Avatar
    Join Date
    Aug 2001
    Posts
    2,686
    I can think of no good reason why you'd want to do that. The solution, however, is simple if you think about it.
    The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.

  8. #8
    Banned
    Join Date
    Oct 2004
    Posts
    250
    well vould you give me a little hint im new to C++

  9. #9
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    If you're new to C++, this shouldn't be a first project. Try learning the language before you do stupid things like this. The last thing we need are more poorly written viruses...er..self-replicating programs.

    Quzah.
    Hope is the first step on the road to disappointment.

  10. #10
    Banned
    Join Date
    Oct 2004
    Posts
    250
    no its not for a virus is anyone going to help me?

  11. #11
    Sweet
    Join Date
    Aug 2002
    Location
    Tucson, Arizona
    Posts
    1,820
    Nope
    Woop?

  12. #12
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    > no i want a program to automatically copy itself a certain amount of times when ran
    Sure sounds like it to me.
    What could be the benefit of that, apart from filling up your disk with copies ?

    > a TXT file but it would be handly if i knew how to copy a .exe file
    A TXT file does not execute (unless M$ really screws up and makes them executable the same way they've gone with JPG files).

    > no its not for a virus is anyone going to help me?
    Not me.
    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.

  13. #13
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,268
    Give us a good reason why a program would need to make copies of itself, and maybe someone will help you then.

  14. #14
    Banned
    Join Date
    Oct 2004
    Posts
    250
    well im trying to make a program that will make a copy of itself before destroying itself

  15. #15
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    It's not reliably possible in pure standard C++.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Copying Files
    By ch4 in forum C Programming
    Replies: 8
    Last Post: 02-14-2009, 04:15 PM
  2. Deep and Shallow Copying
    By peckitt99 in forum C++ Programming
    Replies: 4
    Last Post: 08-18-2007, 09:37 PM
  3. Copying a whole directory and its content
    By Enira in forum C Programming
    Replies: 4
    Last Post: 03-12-2006, 02:13 PM
  4. Shallow/Deep copying, pointers
    By littleweseth in forum C++ Programming
    Replies: 3
    Last Post: 11-26-2003, 06:36 PM
  5. Copying a file
    By rkjd2 in forum C++ Programming
    Replies: 5
    Last Post: 09-09-2001, 10:24 AM