• 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: Cocoa-dev Digest, Vol 3, Issue 58
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cocoa-dev Digest, Vol 3, Issue 58


  • Subject: Re: Cocoa-dev Digest, Vol 3, Issue 58
  • From: Heinrich Giesen <email@hidden>
  • Date: Sat, 14 Jan 2006 17:22:22 +0100

hello,

On 14.01.2006, at 12:44, W. Thomas Leroux wrote:

char  dna1 [100000] = {0};
int random;
int  iterations   = 120000;

you cannot write 120000 bytes into an array of size 100000 not even into an array of 120000. Remember the string terminating Zero.

saver is:
#define MAX_ITERATIONS 123456
char dna1[MAX_ITERATIONS+1] = {0};
int iterations = MAX_ITERATIONS;

If this works (and it works) then make stylisting changes.

BTW: in Cocoa you could use an NSMutableData object which is
more flexible and save concerning buffer overflow.

--
Heinrich Giesen
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
  • Prev by Date: Re: Neatly terminating the app
  • Next by Date: Re: Cocoa Custom NSCell Binding Issue
  • Previous by thread: Re: WebView can't handle simple pages
  • Next by thread: NSMutableData: Adding One char to a NSMutableData Object
  • Index(es):
    • Date
    • Thread