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?
Type: Posts; User: Omar Sharaki
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?
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...
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...
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.
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...
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...
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...
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]));
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) -...
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...
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...
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...
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...
Why are we specifying sizeof(path)-1 and not simply sizeof(path)?
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.)
...
Thanks! I'm now allocating the size of the file to the buffer and it works.
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...