On 17-Aug-08, at 1:52 AM, Ken Thomases wrote:

On Aug 17, 2008, at 12:07 AM, FTB Accounts wrote:

Here is the current code I am running:

This code has many fundamental errors. I think you need to review the basics of the C language first, then of Objective-C. You have to walk before you can run.

You say that you're not getting any errors or warnings when you build this, but that can't be. You would definitely get warnings for this code.

/* START CODE */

#import <Cocoa/Cocoa.h>

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

        NSData *fname = "file:///Users/cknorr/mytest/MYTEST/data.txt";

You are initializing a variable of type NSData* (pointer to NSData). However, the right-hand side is not an NSData*, it's a C- style string, which is a character array (char* or char[]). These are not compatible. It's certainly not meaningful. Any attempt to use the fname variable as though it were a pointer to an NSData object would fail, because it doesn't actually contain a valid pointer to an NSData object.

        NSFileHandle *fh=[NSFileHandle fileHandleForWritingAtPath:fname];

Even if fname did contain a valid pointer to an NSData object, the above would not be correct. The +fileHandleForWritingAtPath: method of NSFileHandle expects a pointer to an NSString object as its argument, but that's not what you're providing.

and file:/// is a URL string, not a file system path.


_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to