Re: debug buffer
- Posted by Derek Parnell <ddparnell at bigpond.com> Sep 25, 2003
- 377 views
----- Original Message ----- >From: sixs at ida.net >Subject: debug buffer > > > >I am having trouble checking data in the buffer. I I >want to find the first position in the buffer and then >then displlay the dat in the buffer how do i get the >first position ? I do a > nextless = find ('A', buffer) > holdtest = buffer[1 ..nextless] By 'buffer' I assume you are talking about reading in a text fle and a sequence is used to hold the text, right? The code above will locate the first occurance of an 'A' in the buffer. Note that if its not there, nextless will be set to zero. Try this... nextless = find ('A', buffer) if nextless = 0 then printf(2, "No 'A' in \"%s\"", {buffer}) else printf(2, "Data upto first 'A' is \"%s\"\n",{buffer[1 ..nextless-1]}) printf(2, "Data from first 'A' is \"%s\"\n".{buffer[nextless .. length(buffer)]{) end if >jim >Is there any article that describes debugging? The best 'debugging' technique is to get somebody else to inspect your code. That will find most bugs before you even run the app. However, if you are using the full version of Eu, the the trace feature is very useful. Otherwise you have to place a lot of 'printf' statement through out your code to examine variables and flow during the running of your program.