• 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
Re: path names with spaces
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: path names with spaces


  • Subject: Re: path names with spaces
  • From: Markus Hitter <email@hidden>
  • Date: Thu, 17 Jan 2002 12:08:24 +0100

Am Donnerstag den, 17. Januar 2002, um 02:01, schrieb Andreas Wolf:

I ran into weird situations when trying to popen() a path that
was retrieved with -(NSString*) pathForResource:ofType because the path
name for that resource contains a space character. The shell that gets invoked
implicitly interprets the space as a delimiter for the path.

Try to put the name into single or double quotes. Should be easier than adding backslashes.

Like:

NSString *path;
unsigned char *tempStr;
FILE *myPipe;

...

sprintf(tempStr, "cat \"%s\"", [path cString]);
myPipe = popen(tempStr, "r");
if (myPipe) ...



Have fun,
Markus

- - - - - - - - - - - - - - - - - - -
Dipl. Ing. Markus Hitter
http://www.jump-ing.de/


  • Follow-Ups:
    • Re: path names with spaces
      • From: "Clark S. Cox III" <email@hidden>
References: 
 >path names with spaces (From: Andreas Wolf <email@hidden>)

  • Prev by Date: Re: path names with spaces
  • Next by Date: Re: HTMLEdit
  • Previous by thread: Re: path names with spaces
  • Next by thread: Re: path names with spaces
  • Index(es):
    • Date
    • Thread