system(); (ps read first then start bout spawn)

This is a discussion on system(); (ps read first then start bout spawn) within the C Programming forums, part of the General Programming Boards category; i know system() isnt as good as spawn but anyway i just use system Code: #include <stdlib.h> system("copy file1.tmp file2.tmp"); ...

  1. #1
    and the Hat of Clumsiness GanglyLamb's Avatar
    Join Date
    Oct 2002
    Location
    between photons and phonons
    Posts
    1,109

    system(); (ps read first then start bout spawn)

    i know system() isnt as good as spawn but anyway i just use system
    Code:
    #include <stdlib.h>
    
    system("copy file1.tmp file2.tmp");
    i try to compile it and it says
    =>undefined symbol _system in module
    i check the borland help content and i dont see where im wrong
    (bc 4.5)
    any help would be great coz im kinda stuck on this stupid thing probably its 2 dumb to c ...

  2. #2
    and the Hat of Clumsiness GanglyLamb's Avatar
    Join Date
    Oct 2002
    Location
    between photons and phonons
    Posts
    1,109
    nopez because i bought it wel "bought" it
    anyway its not a student compiler
    but mayb hmm ill just try it in a smaller code cause its part of a big thing and ill c if that works because the compiler kinda acts stranges sometimes it even wont startup (the compiler i mean)

  3. #3
    and the Hat of Clumsiness GanglyLamb's Avatar
    Join Date
    Oct 2002
    Location
    between photons and phonons
    Posts
    1,109
    ive got two choices
    1) im blind and stupified by errors that arent even
    there

    2)theres something strange with my compiler

    because i just closed the compiler opened it again and i opened the project compiled it and now no errors were found
    So no need to look at this anylonger thx anyway for the "apparently" no-needed comment

  4. #4
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Why not write your own copy functions anyway?
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  5. #5
    and the Hat of Clumsiness GanglyLamb's Avatar
    Join Date
    Oct 2002
    Location
    between photons and phonons
    Posts
    1,109
    why should i if it works fine doing it this way its just i uninstalled BC and installed it again and every thing runs fine now dunno wut the problem was (probably I DID something wrong because a program like BC wouldnt crash on those things)

  6. #6
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Originally posted by GanglyLamb
    why should i if it works fine doing it this way
    Because:
    - it'd be faster
    - it'd be more efficient
    - it'd be much safer (more secure)
    - it'd be easier to detect and handle errors
    - it'd be a learning exercise for you

    Shall I go on?
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  7. #7
    Registered User
    Join Date
    Sep 2001
    Posts
    35
    heyas,
    correct me if i am wrong but i believe that the copy command reads:

    copy c:\temp1.txt TO c:\temp2.txt
    you had copy file1.tmp file2.tmp

    thus shouldnt the system line read

    system("copy c:\file1.tmp TO c:\file2.tmp");

    im not quite sure whether or not the directory is required (c:\) so give both options a go

    hope this helps

  8. #8
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Originally posted by twans
    heyas,
    correct me if i am wrong but i believe that the copy command reads:

    copy c:\temp1.txt TO c:\temp2.txt
    you had copy file1.tmp file2.tmp

    thus shouldnt the system line read

    system("copy c:\file1.tmp TO c:\file2.tmp");

    im not quite sure whether or not the directory is required (c:\) so give both options a go

    hope this helps
    I'll correct you, because you're wrong. In the standard DOS based copy, you use the following format:

    copy <fromhere> <tohere>

    Thus:

    copy file1 file2

    As for paths, since you're passing a string to the function, you must use the proper escapes if using the path:

    system( "copy c:\\file1.bla c:\\myfiles\\file2.bla" );

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

  9. #9
    Refugee face_master's Avatar
    Join Date
    Aug 2001
    Posts
    2,052
    Originally posted by Hammer
    Because:
    - it'd be faster
    - it'd be more efficient
    - it'd be much safer (more secure)
    - it'd be easier to detect and handle errors
    - it'd be a learning exercise for you

    Shall I go on?
    Or you could use the Win API

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Unknown Memory Leak in Init() Function
    By CodeHacker in forum Windows Programming
    Replies: 3
    Last Post: 07-09-2004, 09:54 AM
  2. Next Question...
    By Azmeos in forum C++ Programming
    Replies: 3
    Last Post: 06-06-2003, 02:40 PM
  3. Read Array pro!!Plz help!!
    By Supra in forum C Programming
    Replies: 2
    Last Post: 03-04-2002, 02:49 PM
  4. Doing a read while in an intr handler
    By VirtualAce in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 01-14-2002, 03:20 PM
  5. Serial Communications in C
    By ExDigit in forum Windows Programming
    Replies: 7
    Last Post: 01-09-2002, 09:52 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21