Thread: Help please: Using I/O to Send Compiled Files

  1. #1
    Registered User
    Join Date
    Apr 2007
    Location
    Illinois, USA
    Posts
    10

    Unhappy Help please: Using I/O to Send Compiled Files

    Hi (to those who enjoy a greeting),

    I need help with a task dealing with I/O streams that isn't covered in any basic tutorials or the book I have. My problem is that I need to use a program (compiled from c++ of course) to send a file that will also function as a program to another area of my computer or network. Basically this:

    MY COMPUTER --main program--> NETWORKED COMPUTER

    MAIN PROGRAM (on networked computer) --accessory program--> DIRECTORY (on networked computer)
    Please note: There can't be any calls to copy a file or program from my computer to the other. It must all be rapped neatly in the main program.

    I have tried many things, some of which don't make sense (I got frustrated). I have already tried sending a function to another location by this code:

    Code:
    otherfile << function(parameters);
    However, as I predicted, it sent the returned value of the function rather than the function itself after compilation.

    Please help!

  2. #2
    Registered User
    Join Date
    Mar 2007
    Posts
    8
    Not sure I entirely understand your issue. You want to send a exe file (that is compleat binary) across a winsock connection, to arrive on another computer to be executed?

  3. #3
    Registered User
    Join Date
    Apr 2007
    Location
    Illinois, USA
    Posts
    10
    Well in short I want to send one program to another computer than will send other programs from itself into that some computer.

    It's the raw basics of i/o practice except instead of outputting text I need a functioning piece of code.
    Last edited by Hatchet; 04-02-2007 at 08:44 PM.

  4. #4
    Registered User
    Join Date
    Mar 2007
    Posts
    8
    Well, I'd like to think that the way hex editors do it, is actual binary read and write. So, I would assume you'd open the file in ios::binary and send it over the winsock/network connection, and then save it as it comes in.

  5. #5
    Registered User
    Join Date
    Apr 2007
    Location
    Illinois, USA
    Posts
    10
    Thanks Marek, I will try that.

  6. #6
    Registered User
    Join Date
    Mar 2007
    Posts
    8
    Since the streams are NULL terminated, you should probably stop sending the data on the NULL character, so that when it sends it automatically, it already has it in there and the file doesnt save with two NULL char's. Generally, when you try doing somthing like so, it doesn't save exactly the same and causes errors. But, That's all a matter of how you go about doing it too.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Send files from one computer to another
    By arjunajay in forum Windows Programming
    Replies: 2
    Last Post: 03-27-2009, 11:30 PM
  2. string i/o with files
    By Furious5k in forum C++ Programming
    Replies: 6
    Last Post: 12-24-2008, 03:13 PM
  3. I/O stream files
    By malooch in forum C Programming
    Replies: 4
    Last Post: 12-12-2006, 09:58 AM
  4. i/o text file compiled with .exe
    By canine in forum Windows Programming
    Replies: 3
    Last Post: 03-22-2002, 10:28 AM
  5. reinserting htm files into chm help files
    By verb in forum Windows Programming
    Replies: 0
    Last Post: 02-15-2002, 09:35 AM