Search:

Type: Posts; User: Yonut

Page 1 of 3 1 2 3

Search: Search took 0.01 seconds.

  1. Replies
    16
    Views
    433

    The compiler will let you know. I just think...

    The compiler will let you know.

    I just think sorting through a bunch of strings to find a variable name seems harder in your expample than to just look for a percent sign (%) which isn't a usual...
  2. Replies
    16
    Views
    433

    I don't know if this is a standard, but most...

    I don't know if this is a standard, but most people would write this:

    printf("%s%d%s%s\n", "The number you entered is ", number1, " and the character is ", string1);

    Like this:

    printf("The...
  3. Replies
    7
    Views
    430

    Sorry, I should have included more info. It's...

    Sorry, I should have included more info.

    It's for a webpage, and I need to output all the head information (CSS, Javascript, meta tags). I just didn't want to have to type out `printf` for every...
  4. Replies
    7
    Views
    430

    Best way to print a large amount of text.

    I have been experimenting with C in a cgi environment. What a difference from php.

    Anyway, I'm wondering what's the best way to print a large amount of text? The best I have been able to come up...
  5. Replies
    13
    Views
    464

    Wow Salem, it's like you can see into the future....

    Wow Salem, it's like you can see into the future. I shouldn't have writen off your comment so quickly. I now use the following for my main function template:


    int main (int argc, char *argv[]...
  6. Replies
    13
    Views
    464

    Ty all, this has been interesting.

    Ty all, this has been interesting.
  7. Replies
    13
    Views
    464

    I have no idea how to invoke a program without...

    I have no idea how to invoke a program without using it's filename. It's my understanding that argv[0], when declared in the main function header, will always contain the program filename.
  8. Replies
    13
    Views
    464

    You're right, I just used what was reported from...

    You're right, I just used what was reported from the compiler without giving any thought to the flags I use.

    compilation terminated due to -Wfatal-errors.

    For the record, I always use the...
  9. Replies
    13
    Views
    464

    I feel I might not have been as clear as I could ...

    I feel I might not have been as clear as I could have. I always test for the number of command line arguments because I don't like misusing one of my programs. If a program takes no arguments, I...
  10. Replies
    13
    Views
    464

    Using argc without argv. (-Wfatal-errors)

    Hi,

    I'm starting to notice how much I reuse certain code. For instance, this is a common `test` in many of my programs:

    if(SOME_TEST == FAILED)
    {
    fprintf(stderr, "%s: FUNCTION_NAME...
  11. Replies
    3
    Views
    334

    You might also want to try and make the variable...

    You might also want to try and make the variable you use with `malloc` and `realloc` initialized to `NULL`. Then you can just use `realloc` in a loop without the initial call to `malloc`.
  12. Replies
    2
    Views
    458

    Returning a double pointer help.

    Hi,

    I've racked my brain trying to figure this out. I clearly don't have an understanding of how pointers work.

    I'm trying to return a double pointer from a function. Here is my current code:...
  13. Replies
    3
    Views
    474

    I'm struggling with the pointer swapping. My...

    I'm struggling with the pointer swapping. My first try at sorting a linked list, I emptied the data into an array, sorted the array, and repopulated the linked list. That seemed cumbersome. I'll...
  14. Replies
    3
    Views
    474

    Looking for terminology.

    Hi,

    I was learning about linked lists and while writing a sort function for a linked list, I came across the following for the swapping of the data:

    int temp = t1->x;
    ...
  15. Replies
    3
    Views
    852

    That very interesting. Last night I figured I...

    That very interesting. Last night I figured I could use `strchr` with 194, as it is the only multibyte character. I don't know why I didn't think of expanding to both and using `strstr`. Ty
  16. Replies
    3
    Views
    852

    How to search for a degree symbol ``?

    Hi,

    I'm trying to terminate a string at the first instance of the degree symbol ``. But when I try:

    if((ptr = strchr(data, '')) == NULL)
    ...

    I get the following error:

    error:...
  17. Sweet, and does using this change any forked...

    Sweet, and does using this change any forked processes inputs to character mode as well?
  18. Sorry, I'm not quite understanding. The second...

    Sorry, I'm not quite understanding. The second example I gave doesn't have `getchar()` at all. And it will never enter the first part of the `if`. Also, why would what you said affect the `ch`...
  19. Ok, I just changed the code to see if I could...

    Ok, I just changed the code to see if I could break the loop, and nothing breaks the loop.

    #include <stdio.h>
    #include <unistd.h>
    #include <sys/select.h>

    int main (void)
    {
    // Declare...
  20. Understanding select().

    Hi,

    In a earlier thread, Salem mentioned the use of `select()` and gave the following code example.


    I'm trying to understand how this function operates. I noticed that the loop test is never...
  21. Replies
    1
    Views
    920

    Ok, it looks like I need to use `realpath()` and...

    Ok, it looks like I need to use `realpath()` and then do a `stat()` on the returned path.
  22. Replies
    1
    Views
    920

    readdir - DT_LNK folder or file?

    Hi,

    Using `readdir()`, I get symbolic links returned and the `d_type` is always set to `DT_LNK` regardless of a link to a file or folder.

    How can I determine which file type a `DT_LNK` entry is...
  23. Like it, love, hate it or be indifferent. When...

    Like it, love, hate it or be indifferent. When you live in the REAL world, all feeling/thought are possible.
  24. Replies
    21
    Views
    1,061

    Are you thinking that there is a special field...

    Are you thinking that there is a special field for this data? In the struct, there is an 'int' used for 'mode'. The first struct is informational an does not have a mode, so I use it to store to...
  25. Replies
    21
    Views
    1,061

    Does it have to be a terminator? I am...

    Does it have to be a terminator? I am experiencing the same problem with sending an array of structs. I ignore the first struct and start filling the array from array[1]. Then when done I put the...
Results 1 to 25 of 59
Page 1 of 3 1 2 3