Search:

Type: Posts; User: FrankTheKneeMan

Search: Search took 0.01 seconds.

  1. Replies
    34
    Views
    8,256

    And for the record, he was right. Your code...

    And for the record, he was right. Your code shouldn't even run, by modern C standards. You literally got lucky with memory addressing.
  2. Replies
    34
    Views
    8,256

    I have no idea if Salazar is even reading this...

    I have no idea if Salazar is even reading this thread any more (I somewhat doubt it), but just in case

    Because that's what you programmed it to do? I don't really have any idea how your compiler...
  3. Replies
    2
    Views
    3,033

    Too true. If you really need to pass something...

    Too true. If you really need to pass something "by reference", then you should have a function that expects a pointer, rather than a value. (in the case of altering pointers, then you should expect...
  4. Found it. I wasn't unlocking the right mutex -...

    Found it. I wasn't unlocking the right mutex - I'm using an array of mutexes to lock individual buffer slots, and I was incrementing the array variable, and thus it attempted to unlock the next...
  5. Also, you should check out string formatting...

    Also, you should check out string formatting characters, and how to set limits on them.Wikipedia's prinf page is a good place to start.
  6. Variable. I've been running it with only one,...

    Variable. I've been running it with only one, just to test functionality. Changed it to a broadcast, but it didn't seem to help. All the literature I've read says that once signaled, the thread...
  7. Well, I've pumped the code full of those...

    Well, I've pumped the code full of those diagnostic print statements, and the output goes something like this:



    Indicating that the consumer thread is hanging on the pthread_cond_wait(); I'll...
  8. The way I would do it is: for each guessed ...

    The way I would do it is:


    for each guessed
    for each actual
    if guessed=actual
    continue;
    if board[guessed]=board[actual]
    correct num++;
    ...
  9. Replies
    1
    Views
    1,171

    Does this even compile? Seems unlikely...

    Does this even compile? Seems unlikely...
  10. Start by correctly defining your functions: ...

    Start by correctly defining your functions:

    return_type func_name(arg_type arg, ...){
    // do stuff
    }
    makes a function named func_name, which takes arguments arg (of type arg_type), and...
  11. Replies
    2
    Views
    1,984

    struct tnode *treeread(struct tnode *p) {/*here...

    struct tnode *treeread(struct tnode *p) {/*here it gets stuck in loop*/ if (p!=NULL) {
    treeread(p->left);
    treeread(p->right);
    return p;
    }
    }

    I'm surprised your compiler didn't warn you...
  12. Replies
    8
    Views
    1,065

    Hm... Lots to say here... It looks like you're...

    Hm... Lots to say here...
    It looks like you're trying to read in a string and change all the spaces to underscores. First of all, gets() is a dangerous function. Everyone around here will...
  13. Been searching these threads on and off for a...

    Been searching these threads on and off for a year or two. Only started posting a week or so ago. Thanks for the welcome.

    Sorry to hijack your thread there, damha - did you figure it out or do...
  14. I appreciate errors, and lord knows I make my...

    I appreciate errors, and lord knows I make my fair share of them, but I was serious. Judging from the language, damha is in a class - likely an "Intro to C" how "C programming skills" class. ...
  15. PThreads - specifically pthread_cond_wait and pthread_cond_signal

    Having a little problem with a threaded producer/consumer application - one producer, multiple consumers.


    producer(){
    for (i=9; i<argc; i++){
    //handle files
    input = fopen(argv[i], "r");...
  16. Yo, simmer. If you read the man page for gets it...

    Yo, simmer. If you read the man page for gets it will point that out, and point you to fgets. This is clearly a class/learning type situation here. A little headache now will lead to a better...
  17. Well, if you're starting at 1, then you could...

    Well, if you're starting at 1, then you could always make your loop condition (i && (i<max || ignoremax)), then once you've lost count, and looping is unnecessary anyway, you could break from the...
  18. The question is asking you to basically do the...

    The question is asking you to basically do the following:

    Read in a line of input.
    --- check out the man page for 'gets'
    Check to see whether it contains all of the vowels.
    Print a statement...
  19. Thanks, anduril, I ought have been checking my...

    Thanks, anduril, I ought have been checking my returns. Or, moreover, just been using good coding practices in general.

    Turns out, earlier in my code for the client I had sent a string I declared...
  20. It less uses states as it does co-opt the fact...

    It less uses states as it does co-opt the fact that the board is represented as a char[5] to send easily identifiable messages. "Win.", "Lose", "Err.", etc, which the client recognizes and has...
  21. Socket (SOCK_STREAM) Connection and reread

    I'm writing a pretty trivial game server, and am having some trouble with my sockets and the dataflow therein. I have in my server the following code:


    for(i=0;;i= (i+1)%2){
    send(p[i], board,...
Results 1 to 21 of 22