Incompatible pointer type
Incompatible pointer type
- Subject: Incompatible pointer type
- From: Gary McGill <email@hidden>
- Date: Fri, 15 Jan 2010 10:23:05 -0500
- Thread-topic: Incompatible pointer type
Title: Incompatible pointer type
I am trying to pass a variable to system(). The final code would look like this:
system(“lp –d Internal_Modem –o phone=555-5555 ~/Desktop/fileToFax.pdf”)
If I simply put this line in my code, it works fine. The problem is I have to get the phone number from the database. When I build the string using AppendString I get “warning: passing argument 1 of ‘system’ from incompatible pointer type. Here is the code that builds the string:
NSString *numberToCall = [faxNumber stringValue]; // this gets the fax number from the database
NSString *fileToPrint = @" ~/Desktop/fax.pdf";
NSString *firstPartOfString = @"lp -d Internal_Modem -o phone=";
NSString *addFaxNumber = [firstPartOfString stringByAppendingString:numberToCall];
NSString *completeString = [addFaxNumber stringByAppendingString:fileToPrint];
system(completeString); // THIS SHOULD WORK BUT DOES NOT
NSLog(completeString);
In the run log the NSLog(completeString) looks perfect.
It also says “sh: line 1: \240{\266x: command not found”
Why am I getting an incompatible pointer type?
Really all I need to do is pass the fax number variable to the system() call. If there is an easier way to do this I would greatly appreciate your comments.
Thanks,
Gary
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden