Re: Writing NSString to a file
Re: Writing NSString to a file
- Subject: Re: Writing NSString to a file
- From: Jeff Hawkins <email@hidden>
- Date: Thu, 1 Jun 2006 09:20:25 -0400
Change the extension to .txt and it opens just fine. There is nothing
in the file to tell TextEdit.app its really a rtf file.
Jeff
On Jun 1, 2006, at 5:27 AM, dinu john wrote:
Thanks in advance
What is wrong with this code ?
Code is compiling and working fine (Creating the temp.rtf ) but
when i accessing the temp.rtf file ,
error displaying "temp.rtf couldnot be opened" What is the reson ?
am i want to add anything else for writing a string to
file ?
Dinu
-(void) __WriteString
{
NSString *m_TestStr;
NSFileManager *FlMgr;
FlMgr=[NSFileManager defaultManager];
m_TestStr=@"/Users/Dinu/Desktop/Temp";
[FlMgr createDirectoryAtPath:m_TestStr attributes:nil];
m_TestStr=@"/Users/Dinu/Desktop/Temp/temp.rtf";
NSString *myString = @"Hello From DinuJohn";
const char *utfString = [myString UTF8String];
NSData *myDat = [NSData dataWithBytes: utfString length: strlen
(utfString)];
m_Flag=[FlMgr createFileAtPath:m_TestStr contents:myDat
attributes:nil];
if(m_Flag)
{
NSRunAlertPanel(@"Info",@"The File Created",nil,nil,nil);
}
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40cubeyellow.com
This email sent to email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden