Thread: Help with msvc++ and/or system()

  1. #1
    Gyudo
    Guest

    Help with msvc++ and/or system()

    Ok, I'm trying to pass dir/b/s *.ext > temp.dat to system().

    This works fine when compiled in msvc++ 6. But, it is a console application and does me no good sense I'm trying to get something I can use in pure dos. When I compile with gcc, everything compiles fine but when the above is passed to system(), dir tells me that there are too many parameter - *.ext. Anyone know why this might be?

    A simpler solution I believe, if at all possible, is there a way to make pure dos programs in msvc++?

    Thanks for all the help.

  2. #2
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,793
    MSVC doesnt make "pure dos" programs........"pure dos" went out with the dinosaurs...........

    I dont believe you are still on Dos 6.2, so why cant it be a console app?

  3. #3
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,829
    As Fordy says, you can't make 16 bit programs with VC++, it is a 32 bit compiler. And while we're about it...

    >>> to system().

    ... read here to find out why that is a really bad idea...

    http://www.cprogramming.com/boardfaq.html#execs
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  4. #4
    Gyudo
    Guest
    I've read the board faq before I posted. I'm trying to make a 16-bit program to use with a boot disk (windows 98 probably). The object of this program is to search a hard drive for a particular file or set of files and then delete them. It is mainly going to be used to clean up virus files and such on computers and hence the reason for using a boot disk. Here is a snipet of my actual code:
    Code:
    int main(int argc, char * argv[]){
    
    //code missing that doesn't really pertain to subject
    
            char s[100]="";
    
            strcat(s,"dir/b/s ");
    
            strcat(s,argv[holder]);
    
            strcat(s," > temp.dat");
    
            cout<<"Searching..."<<endl;
    
            system(s);
    I'm trying to use djgpp to compile.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Trouble with MSVC, Mingw32 and Code::Blocks
    By Brafil in forum C Programming
    Replies: 11
    Last Post: 10-12-2009, 11:34 AM
  2. MSVC resource script in Dev-C++
    By josh_d in forum Windows Programming
    Replies: 0
    Last Post: 03-17-2004, 04:07 PM
  3. MSVC behaves strange
    By ripper079 in forum C++ Programming
    Replies: 4
    Last Post: 10-28-2003, 08:34 PM
  4. Blender3D, XML, and MSVC ???
    By Grumpy_Old_Man in forum Game Programming
    Replies: 0
    Last Post: 08-24-2003, 07:00 PM
  5. GCC (cygwin) much faster than MSVC, Borland?
    By Sargnagel in forum C Programming
    Replies: 15
    Last Post: 08-05-2003, 03:15 AM