Thread: MS-DOS commands...

  1. #1
    the Wizard
    Join Date
    Aug 2004
    Posts
    109

    Question MS-DOS commands...

    Is it possible to make a C++ program that executes MS-DOS commands like "net send <ip> <message>"??

    If it is, would somebody please show me a little example

    Thanks in advance....

    -//Marc -//MipZhaP

  2. #2
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    Just put the command you want executed as a parameter in the system command.

    Code:
    #include <stdlib>
    
    int main(void)
    {
        char command[] = "cls"
        system(command);        // These two lines do the
        system("cls");                // same thing - clear the screen
        return 1;
    }

  3. #3
    Its not rocket science vasanth's Avatar
    Join Date
    Jan 2002
    Posts
    1,683
    if you are planinng to do a net send version of this with a list of 100's of IP's then you better using threading since each of those net send command will take time to execute and doing it sequentially can take ages...

  4. #4
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    Would it really make much of a difference, if any? When you do two threads it executes each one simultaneously, but it does each one at half the speed, no?

  5. #5
    the Wizard
    Join Date
    Aug 2004
    Posts
    109
    Okey.. I've looked at your fine example, and I've been testing it with a single net send message. It works perfectly, but when I open the program the message pops up approx. 1 min. later, and that's a bit slow..

    So my question is, is there anything to do about this "slowdown"?
    Last edited by MipZhaP; 08-17-2004 at 07:52 AM.

  6. #6
    Registered User
    Join Date
    Sep 2001
    Posts
    4,912
    There's nothing that I can think of in C++, but I'm not familiar with netsend. Vasanth, however, seems to know what he's talking about - I'd be interested to see what he has to say.

    edit: Actually - if you're sending data over the internet, it may just be because of the time lapse while sending data between the two computers.

  7. #7
    Registered User major_small's Avatar
    Join Date
    May 2003
    Posts
    2,787
    Quote Originally Posted by MipZhaP
    So my question is, is there anything to do about this "slowdown"?
    get a faster network.
    Join is in our Unofficial Cprog IRC channel
    Server: irc.phoenixradio.org
    Channel: #Tech


    Team Cprog Folding@Home: Team #43476
    Download it Here
    Detailed Stats Here
    More Detailed Stats
    52 Members so far, are YOU a member?
    Current team score: 1223226 (ranked 374 of 45152)

    The CBoard team is doing better than 99.16% of the other teams
    Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)

    Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT

  8. #8
    the Wizard
    Join Date
    Aug 2004
    Posts
    109
    sean_mackrory: Yeah, it looks like he knows something about this subject
    major_small: A normal net send msg takes < 1ms, sooo you might be wrong in your "thrown out statement".. My network isn't slow...

  9. #9
    Its not rocket science vasanth's Avatar
    Join Date
    Jan 2002
    Posts
    1,683
    I am not sure how net send exactly works but my guess is it has to do some broadcast lookup to find the machine (not sure abt this) which might take time the first time the message is sent to a particular host...

    I regularly use net send and have noticed random delays and some times the message is never sent....


    [rant]
    and thanx to the person who gave me rep-- for my last post....
    [/rant]

  10. #10
    the Wizard
    Join Date
    Aug 2004
    Posts
    109
    Okey, thx for your answer

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Speed test result
    By audinue in forum C Programming
    Replies: 4
    Last Post: 07-07-2008, 05:18 AM
  2. Executing DOS commands from inside an image
    By Moony in forum C Programming
    Replies: 6
    Last Post: 03-16-2008, 12:40 PM
  3. MS DOS Window closes right away!
    By poolshark1691 in forum C++ Programming
    Replies: 5
    Last Post: 05-24-2005, 11:35 AM
  4. Ping
    By ZakkWylde969 in forum Tech Board
    Replies: 5
    Last Post: 09-23-2003, 12:28 PM
  5. The Timing is incorret
    By Drew in forum C++ Programming
    Replies: 5
    Last Post: 08-28-2003, 04:57 PM