Search:

Type: Posts; User: Yonut

Page 1 of 3 1 2 3

Search: Search took 0.01 seconds.

  1. Replies
    13
    Views
    384

    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[]...
  2. Replies
    13
    Views
    384

    Ty all, this has been interesting.

    Ty all, this has been interesting.
  3. Replies
    13
    Views
    384

    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.
  4. Replies
    13
    Views
    384

    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...
  5. Replies
    13
    Views
    384

    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...
  6. Replies
    13
    Views
    384

    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...
  7. Replies
    3
    Views
    264

    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`.
  8. Replies
    2
    Views
    374

    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:...
  9. Replies
    3
    Views
    404

    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...
  10. Replies
    3
    Views
    404

    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;
    ...
  11. Replies
    3
    Views
    844

    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
  12. Replies
    3
    Views
    844

    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:...
  13. Sweet, and does using this change any forked...

    Sweet, and does using this change any forked processes inputs to character mode as well?
  14. 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`...
  15. 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...
  16. 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...
  17. Replies
    1
    Views
    889

    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.
  18. Replies
    1
    Views
    889

    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...
  19. 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.
  20. Replies
    21
    Views
    886

    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...
  21. Replies
    21
    Views
    886

    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...
  22. Replies
    3
    Views
    309

    Yes, that worked, but I found the following: ...

    Yes, that worked, but I found the following:

    #define COMMAND(dir) "find " dir " -type f -printf '%T@ %t %p\\n' | sort -k 1 -nr | rev | cut -d' ' -f1 | rev"

    Includes the double quotes around the...
  23. Replies
    3
    Views
    309

    Problem with a text macro.

    Hi,

    Just found out about preprocessor macros, and was trying to create a popen command that would include a changing directory.

    I tried the following:

    #define COMMAND(dir) "find " #dir "...
  24. Replies
    6
    Views
    383

    Well I would fix these for sure: if...

    Well I would fix these for sure:



    if (plyr->neighbors[i]->strat == HAWK)
    {
    }
    else
    {
    value += prize;
  25. That is very cool, I think I might be able to use...

    That is very cool, I think I might be able to use that in the future. But part of the appeal of a forked function is being able to send 'SIGSTOP' and 'SIGCONT' to pause and resume the forked process...
Results 1 to 25 of 54
Page 1 of 3 1 2 3