CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Guest

    How do I write a program that copies itself completely?

    I have this extra credit assignment that is to write a program that completely copies itself - and I mean completely - every character. Does anyone know how to do that? If you have an idea, PLEASE notify me ASAP. So you know you aren't violating any ethics, the prof. said we could find the info. anywhere we can. My e-mail address is [email protected]. Thanks and hope to hear from you soon.

    Hint: the System.out.println("..."); command is evidently the method to accomplish this task, but you cannot simply copy the program and paste it into the quotation marks, because as you will soon realize, you will be missing the one System.out.println("..."); command that printed the program... Good luck!


  2. #2
    Join Date
    Jan 2000
    Location
    Canada
    Posts
    249

    Re: How do I write a program that copies itself completely?

    Actually, you could do this without the use of System.out.println().

    Create an instance of FileOutputStream and one of FileInputStream. With the FileInputStream, open the file your program is contained in. Then write it out to the new file using FileOutputStream.

    -------------------------------------------
    weaver
    icq# 64665116
    Please rate this post.
    http://weaver.x7.htmlplanet.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured