• 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
Malloc()
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Malloc()


  • Subject: Malloc()
  • From: Jason Moore <email@hidden>
  • Date: Tue, 2 Apr 2002 00:49:32 -0600

Hello all.. Sorry to keep bothering everyone with C questions, but this one has me totally stumped..

I need to pass some data (in the form of a char* buffer) into a Unix library function. I'm getting my data from an NSData object using GetBytes:range:. My problem is that my buffers are not working.

i have:

char *buffer;
buffer = malloc(bufferSize);
NSLog(@"buffer size is: %i", sizeof(buffer));

here is where the problem is. the log output is 'buffer size is: 4', even when i change the malloc
statement to read buffer = malloc(129) (129 is the size of the buffer i need in my test case).

any ideas?

thanks in advance.

jason
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Malloc()
      • From: Vince DeMarco <email@hidden>
    • Re: Malloc()
      • From: Pete Yandell <email@hidden>
  • Prev by Date: Re: Renaming a project
  • Next by Date: How to access a database through an ODBC connection
  • Previous by thread: Re: How to get objects to not be encoded with NSArchiver
  • Next by thread: Re: Malloc()
  • Index(es):
    • Date
    • Thread