exec problem

This is a discussion on exec problem within the Windows Programming forums, part of the Platform Specific Boards category; If i do Code: execlp("mplayer.exe","mplayer.exe",ComboBox1->Text,NULL); it doesnt happen anything. All the path are corect and if i replace ComboBox1->Text with ...

  1. #1
    Registered User
    Join Date
    Dec 2005
    Posts
    167

    exec problem

    If i do
    Code:
    execlp("mplayer.exe","mplayer.exe",ComboBox1->Text,NULL);
    it doesnt happen anything.
    All the path are corect and if i replace ComboBox1->Text with the path it has in it like:
    Code:
    execlp("mplayer.exe","mplayer.exe","C:\Movie.avi",NULL);
    it works just fine.
    What could the problem be?

    I use borland C++ builder!
    Thank you!

  2. #2
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,761
    Perhaps your combo box stores things as a length, and the data (meaning there is no expicit \0).
    Copy the data to another array, and make sure there is a \0.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  3. #3
    Registered User
    Join Date
    Dec 2005
    Posts
    167
    can execlp receive ansistrings as parameters ?

  4. #4
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,761
    Just char* AFAIK, unless you have something OS specific going on.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  5. #5
    Registered User
    Join Date
    Dec 2005
    Posts
    167
    well ComboBox1->Text is AnsiString... how can I convert it to char* ?

    i have this:
    Code:
    void __fastcall TMain::Button3Click(TObject *Sender)
    {
    	AnsiString S="-sub ";
    	S=S+ComboBox2->Text;
    	if(CheckBox1->Checked) S=S+" -fs ";
    	else S=S+" ";
    	S=S+ComboBox1->Text;
    	ShowMessage(S);
    //	execlp("mplayer.exe","mplayer.exe",S,NULL);
    }
    Last edited by spank; 07-22-2006 at 07:28 AM.

  6. #6
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,761
    *shrug*
    Read the manual pages on AnsiString and it's methods?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  7. #7
    Registered User
    Join Date
    Dec 2005
    Posts
    167
    well... i've done something like this:
    Code:
    char *parametrii=S.c_str();
    execlp("mplayer.exe","mplayer.exe",parametrii,NULL);
    but still doesn't work

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 09:38 AM
  2. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 03:51 PM
  3. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 07:54 PM
  4. Segmentation Fault Problem: Urgent Help
    By bodydrop in forum C Programming
    Replies: 3
    Last Post: 05-05-2006, 09:02 PM
  5. beginner problem
    By The_Nymph in forum C Programming
    Replies: 4
    Last Post: 03-05-2002, 05:46 PM

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