Forum: C Aug 6th, 2009 |
| Replies: 18 Views: 1,118 |
Forum: C Apr 7th, 2009 |
| Replies: 3 Views: 1,179 The wait() (http://linux.die.net/man/2/wait) function monitors the state of a process, not its I/O streams. What you really want is the poll() (http://linux.die.net/man/2/poll) or select()... |
Forum: C Jul 11th, 2008 |
| Replies: 4 Views: 561 I think you need to spend some time tracing through your algorithm. I'm not sure exactly what it is supposed to do, but I don't think it is doing what you want it to do...
(Given "HELLO", the list... |
Forum: C Jun 3rd, 2008 |
| Replies: 20 Views: 1,624 There are only a couple that I'd recommend.
First, straight from esr himself:
http://web.cs.mun.ca/~rod/ncurses/ncurses.html
And another very good one, replete with great examples:... |
Forum: C May 31st, 2008 |
| Replies: 7 Views: 988 I think you are kind of close, but you need to be careful about a couple of things.
The first problem is that the variable lookahead is local to lexan(), so your compiler should be complaining... |
Forum: C Jan 4th, 2008 |
| Replies: 5 Views: 2,144 Agreed, but when dealing with new programmers I have learned by experience (teaching and tutoring) that debugging works best once a firm concept of what should be happing is established. Anyway... |
Forum: C Jan 1st, 2008 |
| Replies: 5 Views: 874 Line 19 should read
newp = (nameval_t *) malloc( sizeof( nameval_t ) );
This is why I recommend just always using parentheses with sizeof. It always works with parens, but makes a difference... |
Forum: C Dec 25th, 2007 |
| Replies: 28 Views: 1,939 For example, you could embed a Tcl (http://wiki.tcl.tk/) interpreter in your program (TCL or Tool Command Language is a script language). Or, you could link a Python... |
Forum: C Dec 23rd, 2007 |
| Replies: 28 Views: 1,939 You could do it something like that, but it introduces more problems than it solves:
fork() doesn't work on Windows. Even if it did, you would still need to set up some IPC to make things work... |
Forum: C Nov 23rd, 2007 |
| Replies: 14 Views: 1,511 I get the following output:
-201 -16
3.141
Did you compile with gcc -traditional-cpp ?
The printf statement just uses as few characters as needed to work.
4. floating point number
* |
Forum: C Nov 6th, 2007 |
| Replies: 1 Views: 611 If you are using the GNU tools, you can say:
gmake -n -p
to print the internal database used to compile without actually compiling anything.
Also, you can get the GNU compiler to give you... |
Forum: C Nov 4th, 2007 |
| Replies: 3 Views: 1,723 Or you could just use the strspn() function:
if (strspn( dnaStr, "AaTtCcGg" ) < strlen( dnaStr )) puts( "error in DNA" ); |
Forum: C Nov 2nd, 2007 |
| Replies: 19 Views: 13,500 Yes, yes, exactly. Thank you.
I've nothing against memcpy(). Just using it improperly. |
Forum: C Oct 28th, 2007 |
| Replies: 5 Views: 661 Best answer is, don't do that.
You are playing with undefined behavior. For any single variable, there should be a maximum of one pre/post increment/decrement operator. Otherwise your results may... |