• 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: creating files to write data to?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: creating files to write data to?


  • Subject: Re: creating files to write data to?
  • From: FTB Accounts <email@hidden>
  • Date: Sat, 16 Aug 2008 22:07:05 -0700 (PDT)

Thanks, all for the responses.

First I changed the path to write to. The folder is writable. On GetInfo for the folder "MYTEST", I have set "Read & Write" permissions for:
You can, Owner, Group, & Others. Is there anything else I need to do to make it write to that folder?

As a side note, I am running an Apache server on the mac I am working on, and I can write PHP programs that will write to this directory.

However, this is still not working. I am not getting anything under  "Errors and Warnings" in Xcode. Also the program loads. However, after running the Debugger does come up.

On debugger there are 5 listed.

0. asm objc_msgSend 0x90a594c0:1
1. ?
2. asm -[NSConcreteFileHandle initWithPath:flags:createMode:] 0x92867509:1
3. asm +[NSFileHandle fileHandleForWritingAtPath:] 0x9287a5e6:1
4. THIS IS BROKEN DOWN IN SUB SECTIONS

[Arguments]
Value: 1
Variable: argc
Value: 0xbffffa5c
Variable: argv
[Locals]
Value: 0x2cf58
Variable: fname
Summary: {(int)[$VAR length]} bytes
Value: 0x1f4c
Variable: fh
Summary: file descriptor: {(int)[$VAR fileDescriptor]}


Here is the current code I am running:

/* START CODE */

#import <Cocoa/Cocoa.h>

int main(int argc, char *argv[])
{

	NSData *fname = "file:///Users/cknorr/mytest/MYTEST/data.txt";
	NSFileHandle *fh=[NSFileHandle fileHandleForWritingAtPath:fname];
	[fh writeData:@"THIS IS A TEST"];
	[fh closeFile];

    return NSApplicationMain(argc,  (const char **) argv);
}



--- On Sat, 8/16/08, Jason Coco <email@hidden> wrote:

> From: Jason Coco <email@hidden>
> Subject: Re: creating files to write data to?
> To: "Andy Lee" <email@hidden>
> Cc: email@hidden, email@hidden
> Date: Saturday, August 16, 2008, 3:33 AM
> On Aug 15, 2008, at 19:35 , Andy Lee wrote:
>
> > On Aug 15, 2008, at 6:43 PM, Jason Coco wrote:
> >> Adding the @ just makes it an NSString constant...
> but writeData
> >> still requires (NSData *), not (NSString *).
> >
> > Argh!  Or perhaps, given the nature of this error,
> which I missed, I
> > should say "Arg!"
> >
> > Surely you got a compiler warning?  If you ignored
> that, surely a
> > runtime error?
> >
> > Check your errors, both at compile time and runtime
> (and treat
> > warnings as errors).
>
> Yeah... I was thinking the same thing... you /must/ have
> got
> warnings... eventually you would have gotten an Exception I
> think :)



_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: creating files to write data to?
      • From: Jason Coco <email@hidden>
    • Re: creating files to write data to?
      • From: RenĂ© v Amerongen <email@hidden>
    • Re: creating files to write data to?
      • From: Ken Thomases <email@hidden>
References: 
 >Re: creating files to write data to? (From: Jason Coco <email@hidden>)

  • Prev by Date: How to debug "The Debugger has exited due to signal 10 (SIGBUS)."
  • Next by Date: Re: creating files to write data to?
  • Previous by thread: Re: creating files to write data to?
  • Next by thread: Re: creating files to write data to?
  • Index(es):
    • Date
    • Thread