Problem: How to make an customized System command

This is a discussion on Problem: How to make an customized System command within the C Programming forums, part of the General Programming Boards category; I want to make a system command, which is special. That means, for example that you can move files. MV ...

  1. #1
    Registered User
    Join Date
    Jun 2012
    Posts
    1

    Problem: How to make an customized System command

    I want to make a system command, which is special.
    That means, for example that you can move files. MV ( I'm talking from Linux) is always the same, but not the file and the target folder. And how I can bring this in the system command?
    Because the files can change and so on...

  2. #2
    - - - - - - - - oogabooga's Avatar
    Join Date
    Jan 2008
    Posts
    2,808
    I think you're asking for something like this:
    Code:
    char filename[100] = "a_file";
    char dirname[100] = "a_directory";
    char cmd[250];
    
    sprintf(cmd, "mv %s %s", filename, dirname);
    system(cmd);
    The cost of software maintenance increases with the square of the programmer's creativity. - Robert D. Bliss

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. system command problem
    By shafqat in forum C++ Programming
    Replies: 4
    Last Post: 08-16-2011, 01:51 PM
  2. Customized assert question...
    By Raigne in forum C++ Programming
    Replies: 10
    Last Post: 02-21-2008, 04:28 AM
  3. Problem with system(""); command!
    By guitarist809 in forum C++ Programming
    Replies: 3
    Last Post: 05-21-2006, 12:39 PM
  4. Problem using system() command.
    By mmongoose in forum C++ Programming
    Replies: 2
    Last Post: 08-20-2005, 09:44 PM
  5. STL and customized headers??
    By mi902klos in forum C++ Programming
    Replies: 3
    Last Post: 04-30-2002, 11:16 PM

Tags for this Thread


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