• 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
Compiler Sometimes Not Handling Escape Sequences in C-Strings?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Compiler Sometimes Not Handling Escape Sequences in C-Strings?


  • Subject: Compiler Sometimes Not Handling Escape Sequences in C-Strings?
  • From: Larry Bright <email@hidden>
  • Date: Sun, 27 Aug 2006 18:53:47 -0700


This one has me tearing my hair out...

I have a small application that is written in a combination of Python and Objective-C (using PyObjC). In the ObjC part of the code I am using fprintf statements to write a text file. The code looks something like this:

    FILE *outFile;        // A global variable

int myFileWriter( char *inFileName)
{
...
outFile = fopen( "outputFileNamedThis", "wb" );
if ( !outFile ) exit(-1);
fprintf( outFile, "Begin analysis of data from %s...\n", inFileName );
...
fprintf( outFile, "\nPhase %d results follow...\n", i );
...
fprintf( outFile, "\n\nAnalysis complete at d:d:d. \n", hr, min, sec );
return resultCode;
}


The file is created and written just fine except for one pesky little problem - the entire content is a single line. All the escaped newline characters appear as two characters in the file - backslash followed by lower-case letter n. I have searched the online documentation, re-read my most basic C books to confirm that I'm not crazy and I still have no idea why the "escaping" of the newline does not work. (I wrote a simpler test program entirely in ObjC [i.e., no Python or PyObjC] and the problem did not occur, but I don't know of any reason why this should give a different result.)

Any ideas or suggestions?


_______________________________________________ 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: Compiler Sometimes Not Handling Escape Sequences in C-Strings?
      • From: Cameron Hayne <email@hidden>
  • Prev by Date: Crash on parent app exit (CFBundleUnloadExecutable)
  • Next by Date: Re: Compiler Sometimes Not Handling Escape Sequences in C-Strings?
  • Previous by thread: Crash on parent app exit (CFBundleUnloadExecutable)
  • Next by thread: Re: Compiler Sometimes Not Handling Escape Sequences in C-Strings?
  • Index(es):
    • Date
    • Thread