Search:

Type: Posts; User: Hammer

Page 1 of 20 1 2 3 4

Search: Search took 0.11 seconds.

  1. Replies
    1
    Views
    4,563

    The select function tests for read/write/error...

    The select function tests for read/write/error conditions on file descriptors. Here's an example that waits 10 seconds for you to enter some data via STDIN, before giving up:
    (its from the faq)

    ...
  2. Replies
    4
    Views
    5,519

    http://cboard.cprogramming.com/showthread.php?t=46...

    http://cboard.cprogramming.com/showthread.php?t=46333#postmenu_321434
  3. Replies
    4
    Views
    5,367

    Another stupidly addictive game

    Don't know if this has been posted before or not...

    http://members.iinet.net.au/~pontipak/redsquare.html

    My best so far is 19 seconds.

    [edit]
    Now 20.875 seconds :)
  4. Replies
    2
    Views
    10,045

    >char type; >type = fgetc(stdin) fgetc()...

    >char type;
    >type = fgetc(stdin)
    fgetc() doesn't return a char, it returns an int.
    http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1048865140&id=1043284351
  5. Thread: asp die()

    by Hammer
    Replies
    4
    Views
    7,358

    Maybe use Response.End ...

    Maybe use Response.End

    http://www.w3schools.com/asp/met_end.asp
    http://www.w3schools.com/asp/asp_ref_response.asp
  6. Replies
    2
    Views
    5,394

    http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?a...

    http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1073433376&id=1073086407
  7. Replies
    12
    Views
    7,603

    In addition to my last post, the following will...

    In addition to my last post, the following will produce a list of all customers with last transaction date, including customers that don't have any transactions. In the latter case, the Max trans...
  8. Replies
    12
    Views
    7,603

    One way: SELECT customers.account,...

    One way:


    SELECT customers.account, Max(transactions.transactiondate) AS MaxOftransactiondate
    FROM customers INNER JOIN transactions ON customers.account = transactions.account
    GROUP BY...
  9. Replies
    11
    Views
    5,388

    http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?a...

    http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1043372399&id=1043284385
  10. Replies
    8
    Views
    3,687

    http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?a...

    http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1045691686&id=1043284392
    http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1042856625&id=1043284385
  11. Replies
    16
    Views
    6,229

    You must error check fopen() and fscanf(). ...

    You must error check fopen() and fscanf().


    inp = fopen("junk1.txt", "r");

    if (inp == NULL)
    {
    perror("fopen");
    ...
    }
  12. Replies
    7
    Views
    3,939

    >>Make those variables global ... and they need...

    >>Make those variables global
    ... and they need to be global because ... ?

    In general terms, only use global variables if you need to share data between functions, and the design makes it hard...
  13. Replies
    7
    Views
    3,939

    >>are there any solution to make the random...

    >>are there any solution to make the random function just generates once
    Sure, just call it once. You'd need to make the variables static if you want to retain their values from one function call...
  14. Replies
    6
    Views
    5,027

    It's getting confused by the newline characters...

    It's getting confused by the newline characters that are output as part of the gcc --version command. Here's one solution:



    $ gcc -DGCCVERSION="\"$(gcc --version|tr '\n' ' ')\"" junk1.c

    $...
  15. Replies
    13
    Views
    10,632

    ... Sending car around where needed. The...

    ... Sending car around where needed. The variable is too small and the program requirements are too simplistic to warrant a pointer at this stage.

    Global variables should be your last choice. ...
  16. Replies
    13
    Views
    10,632

    >>I suggest that you make [car] a global...

    >>I suggest that you make [car] a global variable.
    I don't. Learn how to program properly from day one, don't bodge your program just to be lazy.
  17. Thread: simplify this?

    by Hammer
    Replies
    2
    Views
    3,045

    Forgetting the setup process, the addition of all...

    Forgetting the setup process, the addition of all the sides can be peformed using only one loop. For now, I'll leave it to you to figure out how ;)

    Also, are you sure your program does what you...
  18. Replies
    13
    Views
    10,632

    int displayval() { char car; ...

    int displayval()
    {
    char car;
    printf("Character: %c\t ascii: %u\t hex: %#X\n", car, car, car);
    return (0);
    }
    And what value do you expect car to have when printf() does it's work...
  19. Replies
    13
    Views
    10,632

    >> char car; >> car = getc(stdin); getc()...

    >> char car;
    >> car = getc(stdin);
    getc() returns an int, not a char. You compiler should be warning you of such errors, if it isn't, turning up the warning levels!

    The displayval()...
  20. Why would calling an additional function make it...

    Why would calling an additional function make it easier?
    ... and no, it wouldn't work anyway (see the comments above about NULL pointer initialisation)


    [goddamit, beat!]
  21. Replies
    8
    Views
    4,633

    Did you read:...

    Did you read: http://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1042834793&id=1043284351 ?
  22. Then dump the initFunction completely, and just...

    Then dump the initFunction completely, and just use the alloc:


    Matrix *allocMatrix(int row, int col)
    {
    Matrix *m;

    m = malloc(sizeof(*m)); /* Error check! */

    int i = 0;
  23. Replies
    9
    Views
    4,869

    getchar() reads from stdin (normally the...

    getchar() reads from stdin (normally the keyboard). If you want to read from the file, use fgetc() and pass it your fp variable.
  24. Replies
    1
    Views
    3,001

    You have junk in the input buffer, 'cos you're...

    You have junk in the input buffer, 'cos you're using scanf() to get the number. Two choices:

    Change the way you get the number:...
  25. Thread: pointer problem

    by Hammer
    Replies
    25
    Views
    7,077

    How did you get the file from your Windows...

    How did you get the file from your Windows machine to the *nix one?

    If you ftp it, using standard text mode transfer (normally default), then the CRLFs will be converted, meaning that CRLF on...
Results 1 to 25 of 500
Page 1 of 20 1 2 3 4