Search:

Type: Posts; User: Yonut

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Replies
    2
    Views
    185

    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:...
  2. Replies
    3
    Views
    243

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

    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;
    ...
  4. Replies
    3
    Views
    828

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

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

    Sweet, and does using this change any forked processes inputs to character mode as well?
  7. 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`...
  8. 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...
  9. 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...
  10. Replies
    1
    Views
    803

    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.
  11. Replies
    1
    Views
    803

    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...
  12. 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.
  13. Replies
    21
    Views
    656

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

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

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

    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 "...
  17. Replies
    6
    Views
    268

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

    Well I would fix these for sure:



    if (plyr->neighbors[i]->strat == HAWK)
    {
    }
    else
    {
    value += prize;
  18. 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...
  19. Ha, this IS the rewrite. :) This sounds...

    Ha, this IS the rewrite. :)



    This sounds like a very good idea. I'll have to let my brain chew on that idea for a bit.


    I like that this process blocks. Much more efficient than the while...
  20. I just learned of the word 'mutex', but haven't...

    I just learned of the word 'mutex', but haven't tried anything involving it as it appears to use 'pthreads'. With all the other new programming code I have learned recently, including 'inotify', I'm...
  21. Serialization of forked processes - best practices?

    Hi,

    I have a problem with a race condition involving my display and forked processes. I need to find a way to serialize writing to the display.

    The only way I know to make sure only one...
  22. Replies
    5
    Views
    192

    I used the wrong wording...

    I used the wrong wording...
  23. Replies
    5
    Views
    192

    So you're saying, unless there's an externally...

    So you're saying, unless there's an externally supplied value (user/file input) that gets calculated in the program, all my calculations are constants.

    You kinda blew my mind there! These are the...
  24. Replies
    5
    Views
    192

    Storing and retrieving vs. recalculating.

    Hi,

    Can someone shed some light on whether recalculating a value is faster or slower than calculating and then storing and retrieving the value.

    I understand that amount of time the value is...
  25. Replies
    2
    Views
    831

    Wow, I really have to take the occasional nap. ...

    Wow, I really have to take the occasional nap.

    Ty for your comment, it lead me to the answer. First, I didn't realize I had the colon ':' in the wrong place. After that, I realized I could use...
Results 1 to 25 of 47
Page 1 of 2 1 2