| | |
letter and word counter
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
•
•
Originally Posted by 1o0oBhP
Do you use Dev-C++? I have 4.9.9.0 and if anyone knows how can i observe vaiables at run time??
I just tend to use output statments to see values at runtime ("debugging with printf").
#include <stdio.h>
#include <ctype.h>
int main(void)
{
char text [ 20 ] = "Hello world\n";
size_t i;
for ( i = 0; i < sizeof text; ++i )
{
printf ( "text[%2d] = ", i );
printf ( isprint ( text [ i ] ) ? "'%c'" : "%d", text [ i ] );
putchar( '\n' );
}
return 0;
}
/* my output
text[ 0] = 'H'
text[ 1] = 'e'
text[ 2] = 'l'
text[ 3] = 'l'
text[ 4] = 'o'
text[ 5] = ' '
text[ 6] = 'w'
text[ 7] = 'o'
text[ 8] = 'r'
text[ 9] = 'l'
text[10] = 'd'
text[11] = 10
text[12] = 0
text[13] = 0
text[14] = 0
text[15] = 0
text[16] = 0
text[17] = 0
text[18] = 0
text[19] = 0
*/ Last edited by Dave Sinkula; Dec 15th, 2004 at 4:06 pm. Reason: Added code.
•
•
•
•
Originally Posted by 1o0oBhP
fair enough. Im used to Programming in VB (6 years and before i learned c++) where you can observe variables at run time (ie wats in the string). however my c++ IDE doesnt.... so i dont know what is going on i have to make certain nothing can go wrong
Do you use Dev-C++? I have 4.9.9.0 and if anyone knows how can i observe vaiables at run time??
Here is the poop:
Debugging with Dev C++:
Make sure you are using a project!
Go to Project Options > Compiler > Linker and set Generate Debugging Information to yes. Make sure you are not using any optimization options or the strip option!!!
Now do a full rebuild with Ctrl-F11, then set breakpoints where you want the debugger to stop. To set a breakpoint on a line, put your cursor on the line and press Ctrl-F5 (or click on the gutter left of the line). You can add or remove breakpoints during the debug session, but need to have at least one to start with.
Launch the debugger clicking the debug button (or F8). The program stops at the first breakpoint. You can step through the code and enter function calls, by clicking on the "step into" button (or Shift-F7), or stepping over the function calls, by clicking the "next step" button (or F7). To go to the next breakpoint click the "continue" button (or Ctrl-F7).
When the program is at a breakpoint, and you are stepping through the code, you can display the values of various variables in your program by putting your mouse over the variable name. You can also display variables and expressions by pressing the "add watch" button (or F4) and typing the expression.
This info should be in the help included with Dev-C++.
I do prefer Dave's way of run-time debugging, just offset the code a little so you can remove it later.
May 'the Google' be with you!
cheers vega, i overcame the problem in the end anyway using an html logfile -> easier to read and break up into tables for arrays ect...
What is the problem (if any) with the frequency counter?? looks ok at first glance, hows the project going chriswell? Would be interested to see if you got the whole source working correctly!
What is the problem (if any) with the frequency counter?? looks ok at first glance, hows the project going chriswell? Would be interested to see if you got the whole source working correctly!
http://sales.carina-e.com
no www
no nonsense
coming soon to a pc near you! :cool:
no www
no nonsense
coming soon to a pc near you! :cool:
•
•
Join Date: Jul 2005
Posts: 1
Reputation:
Solved Threads: 0
I know that this is way late but just found this site and this IS a program that our company is interested in... actually, we have a similiar program already in use but it was written way back and we are hoping to upgrade the system that the program is on.
The counter currently works on a Win98SE with an LPT 1 direct line to an Epson dot matrix printer. Have tried it on WinXP Pro and no go. So this is one item that is holding us back.
Has anyone found or written this type of program?
bg
The counter currently works on a Win98SE with an LPT 1 direct line to an Epson dot matrix printer. Have tried it on WinXP Pro and no go. So this is one item that is holding us back.
Has anyone found or written this type of program?
bg
![]() |
Similar Threads
- Capitalizing first letter of word in an array? (C)
- word counter, frequency, percentage (Java)
- word counter (C++)
Other Threads in the C Forum
- Previous Thread: SDK FOR Windows XP
- Next Thread: Gui autogenerated code in .h instead of .cpp
| Thread Tools | Search this Thread |
#include * ansi append array arrays asterisks binarysearch calculate changingto char character cm convert copyimagefile cprogramme creafecopyofanytypeoffileinc database dynamic execv feet fflush fgets file fork forloop framework function getlasterror givemetehcodez grade gtkwinlinux hacking hardware histogram inches include incrementoperators input intmain() iso kernel keyboard km license linked linkedlist linux list lists locate logical_drives looping loopinsideloop. lowest matrix microsoft motherboard mqqueue number oddnumber odf opendocumentformat opensource overwrite owf pattern pdf performance pointer posix probleminc process program programming radix recursion recv recvblocked research reversing scanf scripting segmentationfault sequential socket socketprograming standard string systemcall testing threads turboc unix user variable voidmain() wab whythiscodecausesegmentationfault windowsapi







