Search:

Type: Posts; User: Omar Sharaki

Search: Search took 0.01 seconds.

  1. Thanks auto fixed it. I also freed the memory I...

    Thanks auto fixed it.
    I also freed the memory I allocated for the threads. I'm wondering though is it generally more advantageous to use containers over arrays?
  2. Dealing with '... is not a class, struct, or union type' error

    I have a function x_gradient() which creates a certain number of threads to carry out an edge detection task using the boost library. The threads each execute a function x_gradient_par() and this is...
  3. It turns out I needed to state the type when...

    It turns out I needed to state the type when calling the function and I wan't doing that. What I was doing was attempt to pass a type as a parameter to the function.
    Here's what changed:

    When...
  4. No difference. I actually don't think there would...

    No difference. I actually don't think there would be anything wrong with the includes since this is an assignment and that part at least was provided by the lecturer.
  5. Type/value mismatch while passing type as parameter to function

    Inside a function x_gradient(), I declare a type dst_channel_t like so:



    typedef typename channel_type<DstView>::type dst_channel_t;


    I'm trying to pass this type as a parameter to a...
  6. Datatype errors while threading using templates

    Hi everyone,

    I'm struggling with a particular c++ assignment. We're asked to parallelize a sequential task that uses the boost library to detect edges in a given image, but I just can't seem to...
  7. I'm assuming this isn't good C-style though...

    I'm assuming this isn't good C-style though right? It just seems counter intuitive that you're forced to declare how many elements your array is gonna contain only for the compiler to let you go...
  8. Declaring an array and then accessing elements that should be out of bounds.

    Hi everyone,

    I have the following lines of code in front of me:



    unsigned char (*image)[x_resolution][3];
    image = malloc(x_resolution * y_resolution * sizeof(char[3]));
  9. Replies
    12
    Views
    1,853

    One last thing though. Take a look at this code....

    One last thing though. Take a look at this code. It's a modified version of sample 1.


    #define NUMBERS "/tmp/numbers"
    int main() {
    char path[10];
    strncpy(path, NUMBERS, sizeof(path) -...
  10. Replies
    2
    Views
    1,334

    Copying a file using sockets

    So I have a client and a server. The client receives the names of the source and destination files from the command line. The server receives the destination file's name and checks if it already...
  11. Replies
    12
    Views
    1,853

    Yes, but only if we're trying to copy more bytes...

    Yes, but only if we're trying to copy more bytes than the length of src i.e. if n>sizeof(src) then n-sizeof(src) 0s will be padded to the end of dest. I can't see that happening in sample 2 and 3...
  12. Replies
    12
    Views
    1,853

    Oh also, I'm still confused as to why sample 2...

    Oh also, I'm still confused as to why sample 2 tells me that path is 11 chars long even though only 8 bytes were copied.

    strncpy(path, NUMBERS, sizeof(NUMBERS)-5); //sizeof(NUMBERS)-5) = 8
    And...
  13. Replies
    12
    Views
    1,853

    By buffer you mean dest, right? Also, sample one...

    By buffer you mean dest, right?
    Also, sample one was written by my professor, so you can't BOTH be wrong. But it still didn't make sense to me to specifically copy sizeof(path)-1 Bytes if you're not...
  14. Replies
    12
    Views
    1,853

    Why are we specifying sizeof(path)-1 and not...

    Why are we specifying sizeof(path)-1 and not simply sizeof(path)?
  15. Replies
    12
    Views
    1,853

    Playing around with strings

    So I'm gonna show you guys some code samples along with the results I get in the hope that you will help me understand why I'm seeing what I'm seeing(Assume all required header files are included.)
    ...
  16. Replies
    2
    Views
    575

    Thanks! I'm now allocating the size of the file...

    Thanks! I'm now allocating the size of the file to the buffer and it works.
  17. Replies
    2
    Views
    575

    Copying contents of file to another

    This program is supposed to copy from a source file to a destination file. The files are to be given as command line parameters, source file being the first parameter and the destination file being...
Results 1 to 17 of 17