Compiler Sometimes Not Handling Escape Sequences in C-Strings?
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