Search:

Type: Posts; User: Blasz

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Replies
    4
    Views
    5,844

    Yep, I'm having trouble making that into an...

    Yep, I'm having trouble making that into an equation though.

    I also meant less than or equal to an integer n.

    So basically its 2^(position of leftmost 1 in binary) but I don't know how to make...
  2. Replies
    4
    Views
    5,844

    Largest Power of 2 less than or equal to integer n

    What is an equation to find the largest power of 2 less than or equal to integer n using basic operators, ie, +-*/^ logic gates mod rem?
  3. Replies
    3
    Views
    1,067

    Nvm, I solved the problem. Had nothing to do with...

    Nvm, I solved the problem. Had nothing to do with memory. Just a random coding bug.
  4. Replies
    3
    Views
    1,067

    Memory/memset problem

    Nvm, solved.
  5. Replies
    3
    Views
    3,301

    Thanks. I was getting sscanf and printf mixed up.

    Thanks. I was getting sscanf and printf mixed up.
  6. Replies
    3
    Views
    3,301

    printf format specifier padding

    I want to use padding when i print stuff.

    The normal way is


    printf("%5s",string)

    But I want the number 5 to be replaced by a variable, as i want the padding to vary based on that...
  7. Replies
    19
    Views
    2,999

    OK I see now, thanks for explaining. I'm...

    OK I see now, thanks for explaining.

    I'm probably going to leave the code as it is though, because i have limited time, lots more to do and don't want to stuff up anything.
  8. Replies
    19
    Views
    2,999

    OK I will try to explain why I think the 3...

    OK I will try to explain why I think the 3 pointers are justified.

    My threads have to communicate with each other and share common variables. Without using global variables or pipes between...
  9. Replies
    19
    Views
    2,999

    Your first post didn't have the right brackets...

    Your first post didn't have the right brackets though.

    And my added level of indirection is not pointless as I have said....

    Anyway, thanks for your help. I appreciate the time you have given...
  10. Replies
    19
    Views
    2,999

    If you change // sscanf(buffer, "%s",...

    If you change


    // sscanf(buffer, "%s", *ptptp[i]);

    to


    // sscanf(buffer, "%s", (*ptptp)[i]);
  11. Replies
    19
    Views
    2,999

    I will be using mutexes but the lack of them at...

    I will be using mutexes but the lack of them at the moment is not causing the segfault. What do you mean the *** is not compatible with sscanf?

    The ***, as i said earlier, is a pointer to an array...
  12. Replies
    19
    Views
    2,999

    Multiple threads will be updating the array of...

    Multiple threads will be updating the array of strings and therefore when the struct is passed to them in the form of pthread_create, they can freely edit/share variables through the use of pointers...
  13. Replies
    19
    Views
    2,999

    This is actually run on solaris so I can't use...

    This is actually run on solaris so I can't use that I'm afraid.

    EDIT: Triple pointer is a pointer to an array of strings.
  14. Replies
    19
    Views
    2,999

    Segfaulting/memory access for array (Linux)

    Whenever I try to access the 3rd element or higher of this 2d array, i keep getting segfaults because apparently i havnt allocated any memory there... but I have.



    typedef struct {
    char...
  15. Replies
    11
    Views
    4,791

    Can you suggest a good site that tells you how to...

    Can you suggest a good site that tells you how to setup a sighandler?

    The man page didn't really help.
  16. Replies
    4
    Views
    3,237

    Sorry, I forgot to use the search function here....

    Sorry, I forgot to use the search function here. Was just googling.

    Some questions about your code for storing from that thread.


    char **args = NULL;
    int argcount = 0;

    while input
    pop...
  17. Replies
    4
    Views
    3,237

    How do i make an array of pointers for execvp

    I am trying to use the execvp command and require an array of pointers for the 2nd argument.
    I am storing the arguments in an array of strings. How would I turn that array of strings into an array...
  18. Replies
    2
    Views
    1,392

    Blocking Read, what is it?

    I have come across the term blocking read, but I don't know what it means. I've tried googling but can't find an answer.

    I'm guessing it means read from a stream in blocks rather than in lines or...
  19. Replies
    11
    Views
    4,791

    I don't think I would want to use wait(), as if I...

    I don't think I would want to use wait(), as if I sent correct information to the child program, I don't want the parent to stall at wait(), if the child program will not exit, until further input is...
  20. Replies
    11
    Views
    4,791

    Checking for child process errors?

    If i was to create a child process that executes a program, and then send some garbage to the child program through a pipe, resulting in an error, how would i detect an error like this in the parent...
  21. If str does not contain the whole line as a...

    If str does not contain the whole line as a string, how will &str[pos] contain the rest of the string, as str only holds the first word as a string?
    This prints out a blank line when i enter "test...
  22. Would str contain the whole line as a string (ie...

    Would str contain the whole line as a string (ie including the whitespaces), is that what the %n does?
    If not, wouldn't
    remainderString = &getLine[pos];
    be what i want?
  23. Thanks for that. Another question, when i use...

    Thanks for that.

    Another question, when i use the fgets() function to read a line from a file or stdin, is there a way i can put everything after the first string into a string of its own.
    For...
  24. How to check if a string contains a smaller string?

    I was wondering if there is a function or an easy way of checking to see if a smaller string is inside a bigger string.
    For example,


    char *string1 = "hello";
    char *string2 = "asdjasd hello...
  25. Replies
    5
    Views
    23,573

    nvm that, it works now, thanks for your help.

    nvm that, it works now, thanks for your help.
Results 1 to 25 of 34
Page 1 of 2 1 2