Mac Help Forums


Reply
Thread Tools Display Modes

external application argument

 
New Member
Join Date: Mar 2006
Posts: 1
 
      16th March 2006
Hi,
I'm building cocoa application which launch external command line application.
The command line requires file as an input and output as a file as well.
In the command line will be: nfbtrans <inputFile.txt >outputFile.txt which means take input from inputFile and store the result in outputFile. It works fine.
In cocoa, part of my program is as follows:

NSTask *task;
task = [[NSTask alloc] init];
[task setLaunchPath: @"/usr/local/bin/nfbtrans"];

NSArray *arg;
NSString *inFileArgument = @"</inputFile.txt";
NSString *outFileArgument = @">/out.txt";
arg = [NSArray arrayWithObjects:inFileArgument,outFileArgument, nil];
[task setArguments:arg];
[task launch];

The command line application launched but it said that the inputFile.txt doesn't exist. However, when I check in the directory, the file does exist. I suspect that it has problem with "<" character. Is that any special way to handle special characters arguments?

Thank you in advance.
 
Reply With Quote
 
 
 
 
Ric Ric is offline
Senior Member
Ric's Avatar
Join Date: May 2004
Posts: 4,260
 
      18th March 2006
Hi there and welcome !

first question...do you get this error when doing a 'Build and Run' in Xcode ?

Have you tried doing a Build and then quitting Xcode and Running the 'Built App' this may work...when looking at the 'Built' App in the Finder control click on it to see if the files are there...

regards

Ric
 
Reply With Quote
 
Senior Member
Kaveman's Avatar
Join Date: Nov 2010
Location: Westland, NZ
Posts: 1,360
 
      13th June 2011
I think the @">" and the @"/inputFile" need to be separate things in the NSArray. Ones a switch the other a FilePath.
 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Applescript application: retrieve argument and execute .sh file Muffinman AppleScript 2 14th April 2011 08:12 AM
the price argument against apple heron stone Mac 0 26th March 2010 04:28 PM
10.4 External Drives, Invalid Argument.... testinguy Mac 4 27th June 2005 06:26 PM
Launching MacOs application with argument... Kam Programmer Misc 2 29th July 2004 08:59 AM
Launching MacOs application with argument... Kam Mac 2 29th July 2004 08:59 AM


All times are GMT +1. The time now is 10:09 PM.
Mac-Help.com is an independent website and is not affiliated with Apple Inc.


Welcome!
Welcome to the Mac Help Forums
 


Latest Threads
Yikes! Teacher needs help!
Mollyc4627 (1 Hour Ago, 08:57 PM)

Unable to log in to websites
AMonty20 (4 Hours Ago, 05:52 PM)

Add Different Speech Commands
bae_22 (5 Hours Ago, 04:40 PM)

Login (2 macs) passwords spontaniously changed?
Roger Vaught (6 Hours Ago, 03:31 PM)

Best car charger or inverter for Macbook Pro?
imeme87 (6 Hours Ago, 03:22 PM)

 


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51