Search:

Type: Posts; User: tcpl

Search: Search took 0.01 seconds.

  1. Thread: Loading animation

    by tcpl
    Replies
    6
    Views
    1,612

    If your compiler provides it, you could use the...

    If your compiler provides it, you could use the non-standard functions gotoxy and clrscr.
  2. Thread: K&R question

    by tcpl
    Replies
    10
    Views
    1,387

    K&R question

    This is probably the fifth time I am reading this book and everytime around I notice little details that I had not noticed previously. This time, right on the beginning of the book, something caught...
  3. Replies
    17
    Views
    3,442

    Your formatting is horrible :p Well, you...

    Your formatting is horrible :p

    Well, you could ask the user to enter a negative number when he or she is done inputing the other numbers.
  4. Replies
    7
    Views
    2,573

    If it fits, fgets will also read the \n into the...

    If it fits, fgets will also read the \n into the buffer, that's why the last name is being printed on the other line. There are many ways to get rid of the \n. I personally do it like this:

    ...
  5. Replies
    6
    Views
    1,603

    I gave you a very simple example: understand and...

    I gave you a very simple example: understand and use it.

    The answer to your question is no.
  6. Replies
    6
    Views
    1,603

    Pointers are your friends... #include...

    Pointers are your friends...


    #include <stdio.h>

    int foobar (int *n)
    {
    *n = 10;
    return 5;
    }
  7. Replies
    4
    Views
    996

    c = tolower(c); if (c == 'a' || c == 'e' || ...)...

    c = tolower(c);
    if (c == 'a' || c == 'e' || ...)
    ...

    That should get you started.
  8. Thread: K&R question

    by tcpl
    Replies
    1
    Views
    825

    Nevermind, it is there :o

    Nevermind, it is there :o
  9. Thread: K&R question

    by tcpl
    Replies
    1
    Views
    825

    K&R question

    On page 176, after declaring the FILE structure, the authors declare an array of 20 FILE structs called _iob and define stdin to be &_iob[0], stdout to be &_iob[1], and &_iob[2] to be stderr. So far...
  10. And just to clarify things a little bit more, in...

    And just to clarify things a little bit more, in C, newlines(\n), tabs(\t), return carriage(\r), etc are all refered to as whitespace.

    EDIT: forgot to close the "quote" tag ;)
  11. Replies
    32
    Views
    3,336

    Assuming a well behaved user, I will tell you a...

    Assuming a well behaved user, I will tell you a way to read the first number into an array:


    int c;
    char *p;
    char number_one[251];

    p = number_one;
    while ((c = getchar()) != '*')
    *p++ =...
  12. I think you're using MS Visual C++ too much...

    I think you're using MS Visual C++ too much...
  13. Just call fopen with the file name and the "w"...

    Just call fopen with the file name and the "w" parameter and it will create/overwrite a file in the executable's directory...
  14. Replies
    25
    Views
    3,327

    I usually do this: #include void...

    I usually do this:


    #include <string.h>
    void cleanup(char *s)
    {
    char *p;
    int c;

    if ((p = strchr(s, '\n')) != NULL)
  15. Replies
    25
    Views
    3,327

    Just make sure you don't forget that, in this...

    Just make sure you don't forget that, in this case, if you type less than 29 characters, fgets() will also read a \n into the buffer and this might cause you trouble if you're going to compare the...
  16. Wow, that is a long post :D Take a look at...

    Wow, that is a long post :D
    Take a look at this and see if it gives you any ideas...


    #include <stdio.h>

    int main(void)
    {
    int x;
    int y;
  17. Thread: K&R question

    by tcpl
    Replies
    2
    Views
    998

    K&R question

    I am reading the second edition of this great book and I have a question about a function that can be found on page 69. Here is the function:


    int getline(char s[], int lim)
    {
    int c, i;
    ...
Results 1 to 17 of 17