• 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: Another newbie EXC_BAD_ACCESS in C
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Another newbie EXC_BAD_ACCESS in C


  • Subject: Re: Another newbie EXC_BAD_ACCESS in C
  • From: John Stiles <email@hidden>
  • Date: Sat, 14 Jan 2006 07:52:56 -0800

I believe an earlier post already mentioned that you are putting more data in "dna1" than it can hold. That would be one explanation. Try making dna1 bigger.
BTW, using strcat in this way is extremely inefficient. Every time strcat is called, the CPU needs to examine the entire string. As the string gets longer and longer (over 100000 characters!) this becomes ridiculously lop-sided--the CPU is reading 100000 characters to write 2 characters.
Please review earlier suggestions on the thread for how to fix it.



W. Thomas Leroux wrote:


Hi John, I shouldn't have put my additional comments at the bottom of my email, but I did try running it with the Debugger, but it does not specify a line. It does point to this in the debugger window, but not little Warning or caution triangles pop up in the code editor.


#0    0x90021b48 in strcat

Which appears to point to this line:

       strcat(dna1,da);

Which, as far as I can tell, looks fine.

Thanks!

Thomas


On 13-Jan-06, at 9:47 PM, John Stiles wrote:

Without reading the code, might I suggest running it with the debugger enabled? Xcode has a useful "Build & Debug" button which will pinpoint the line of failure.

On Jan 13, 2006, at 6:33 PM, W. Thomas Leroux wrote:

Hello all,

I'm trying my first foray into writing a (shell) program for OSX - it has been a *every* long time since I have looked at C, but here is what I have generated:


[snip]

However, when I Build and Debug it, I get an EXC_BAD_ACCESS error - put no specific line error. I'm a bit befuddled, because it looks like the code should work, and I figured someone with a fresh eye would spot the issue faster than I can.

Thanks!

Thomas.



_______________________________________________
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


References: 
 >Another newbie EXC_BAD_ACCESS in C (From: "W. Thomas Leroux" <email@hidden>)
 >Re: Another newbie EXC_BAD_ACCESS in C (From: John Stiles <email@hidden>)
 >Re: Another newbie EXC_BAD_ACCESS in C (From: "W. Thomas Leroux" <email@hidden>)

  • Prev by Date: Re: WebView can't handle *simple* pages that Safari can???
  • Next by Date: Re: WebView can't handle *simple* pages that Safari can???
  • Previous by thread: Re: Another newbie EXC_BAD_ACCESS in C
  • Next by thread: Re: Another newbie EXC_BAD_ACCESS in C
  • Index(es):
    • Date
    • Thread