• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Incompatible pointer type
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Incompatible pointer type
      • From: Jens Alfke <email@hidden>
    • Re: Incompatible pointer type
      • From: Julien Jalon <email@hidden>
    • Re: Incompatible pointer type
      • From: "Jeffrey R. Kelley" <email@hidden>
  • Prev by Date: Re: Developing for 10.4 and up
  • Next by Date: Re: Incompatible pointer type
  • Previous by thread: Change xcode language from chinese to english
  • Next by thread: Re: Incompatible pointer type
  • Index(es):
    • Date
    • Thread