system function input from array

This is a discussion on system function input from array within the C Programming forums, part of the General Programming Boards category; I have the path to an MP3 stored in an array and would like to append it to a command ...

  1. #1
    Registered User
    Join Date
    Aug 2011
    Posts
    24

    system function input from array

    I have the path to an MP3 stored in an array and would like to append it to a command passed to system().

    Code:
    system("mplayer FILE")
    How might I be able to enumerate the contents of the array so as to present them as an argument to mplayer?

  2. #2
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    Code:
    char command[256] = "mplayer ";
    strcat[command,filename];
    system(command);

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 4
    Last Post: 10-29-2011, 07:02 PM
  2. Input values into array using function
    By yacek in forum C Programming
    Replies: 3
    Last Post: 12-10-2010, 11:37 AM
  3. Client-server system with input from separate program
    By robot-ic in forum Networking/Device Communication
    Replies: 3
    Last Post: 01-16-2009, 02:30 PM
  4. Replies: 3
    Last Post: 04-30-2006, 06:01 AM
  5. system call with user input
    By enlinux in forum C Programming
    Replies: 7
    Last Post: 03-02-2003, 09:23 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