Search:

Type: Posts; User: brooksbp

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Replies
    1
    Views
    2,233

    Poll directory to detect a change?

    I want to write a program to do something whenever a certain type of file appears in a certain directory. What's the best way to do this?

    Do you have to poll the directory to detect the change? ...
  2. Duplicates don't matter. So yes the function...

    Duplicates don't matter. So yes the function should return true on abccd/abcdd.



    Yeah. It just so happened that the last test case I ran was testing for a positive match.


    Anymore...
  3. This seems to be slightly slower on a few trials,...

    This seems to be slightly slower on a few trials, but less bloated and prettier :) Thanks for that!
  4. Yes. Can anyone find a faster way to do this?

    Yes. Can anyone find a faster way to do this?
  5. Looking for optimal solution to: bool HasSameChars()

    Create an algorithm that checks whether two strings have the same characters (duplicates don't matter). Assuming a char == 1 byte so there are 2^8 = 256 possible characters.

    Function prototype...
  6. Replies
    7
    Views
    1,682

    ..."right" meaning arithmetically right... In...

    ..."right" meaning arithmetically right...

    In python: 1073741824 * 2 = 2147483647 this is arithmetically correct.

    Why does the above C program even compile? Let alone produce that output?
  7. Replies
    7
    Views
    1,682

    easy arithmetic question

    #include <stdio.h>
    #include <math.h>

    int main()
    {
    int i = 1073741824ul;
    int total = i + i;
    printf("%d", total);
    ...
  8. Replies
    4
    Views
    2,342

    cool. thanks citizen. I really hate having to...

    cool. thanks citizen. I really hate having to use nasty pointer arithmetic... sucks when you can't model or express functionality using formal constructs...
  9. Replies
    4
    Views
    2,342

    Question about pointer arithmetic and types

    So I would like to know how a pointer acts based on its type.


    char *ptr; /* char == 1 byte */

    So say the memory looks like this; and the pointer points to the byte of memory indicated with...
  10. Looks like I'll have to end up with that...

    Looks like I'll have to end up with that implementation. Wish C allowed dynamic structures like described above.
  11. Complex struct organization (network/packet-related)

    Quick little structure organization problem. Basically revolves around how do you define a set of structures with optimal memory layout for networking purposes; set as in, dynamic fields in a...
  12. Replies
    4
    Views
    3,277

    okay. I actually misinterpreted the semantics of...

    okay. I actually misinterpreted the semantics of the code. I was actually told to use


    uchar hash_code[0];

    as a pointer, and then use that to malloc 128 bits. Apparently it's more proper...
  13. Replies
    1
    Views
    2,530

    Implementing TLVs

    Hi,

    I'm implementing a custom network protocol in C that contains a header and numerous TLVs. Does anybody have any example code for how to implement TLVs in C? What types of structures/unions,...
  14. Replies
    4
    Views
    3,277

    128 bit uchar array? please help

    Hi I need a 128 bit int-like data type. I was told to use code like this:


    uchar hash[0];

    Apparently the compiler will know it's 128 bits at compile-time? Anyways, what's the most elegant...
  15. Replies
    8
    Views
    2,378

    I just don't understand why it wont recognize the...

    I just don't understand why it wont recognize the heap functions even though heap.h is included????


    brooksbp@brooksbp-laptop:~/csci2270/assign5$ g++ studentDemo.cxx -o test
    studentDatabase.cxx:...
  16. Replies
    8
    Views
    2,378

    Still doesn't work. Spits out about 75 more...

    Still doesn't work. Spits out about 75 more lines of errors
  17. Replies
    8
    Views
    2,378

    nah.... that produces-> ...or... is that the...

    nah.... that produces->

    ...or... is that the right way to compile it, and those are all bugs? If so, how do i dereference a pointer to a class and call the member function... like...
  18. Replies
    8
    Views
    2,378

    Gnarly Linking Error HELP!!!!

    Okay. Fairly complicated program involving templates, classes, and a driver program. All files are within the same directory. Pretty damn sure that all functions are defined and declaired... just...
  19. Thanks Daved. That was exactly the solution I...

    Thanks Daved. That was exactly the solution I needed.

    In my case I had to change the return type of getItem() to be a non-const reference. It makes sense to use get and set functions for this,...
  20. Yeah... I can't change multiply. It would be...

    Yeah... I can't change multiply. It would be nice if I could and then use setItem() like you suggested.

    True on the return type. Just making sure it executes correctly.
  21. I wouldn't know. Most likely not. But, the...

    I wouldn't know. Most likely not.

    But, the Process takes a reference parameter ->


    void multiply(int& n, int b)
    {
    n = n * b;
    }
  22. template class...

    template <class Item, class Key>
    class heapnode
    {
    public:
    heapnode(const Item& init_data = Item(), Key init_key = Key(), heapnode* init_left =...
  23. Replies
    8
    Views
    1,287

    Style advice bro... I and others would prefer...

    Style advice bro... I and others would prefer reading code comparing pointers to NULL rather than 0 which could be quickly overlooked as an int esp if you haven't seen the variable name declared as a...
  24. Replies
    3
    Views
    1,536

    google "reheapification for binary trees" ...

    google "reheapification for binary trees"

    don't remember all the properties off the top of my head, but both of your reheapifications look correct. Keep in mind that whether you use left subtree...
  25. Replies
    8
    Views
    1,287

    Can't find the error yet, but you might want to...

    Can't find the error yet, but you might want to check pointers for NULL rather than 0. Also, theBase isn't really defined anywhere. I assume it's a global pointer to the base...?

    Also when you're...
Results 1 to 25 of 40
Page 1 of 2 1 2