views:

100

answers:

1

I want to modify a program that grabs images from a camera capture board, now its using a char and says its limited to 1000 images, its early/late and I need sleep, so maybe there is a better way to go about this, but I am thinking maybe I could just substitute all the related data variables with higher capacity data types... right now its defining memory with malloc, if that helps at all.

+2  A: 

My guess is that changing char to say, int32, will not work. Most likely the data is stored as 8 bit value for each channel or so, thus using a char and changing the type to a larger one will just add memory usage overhead.

What you are looking for is a constant/literal with a value of 1000 that can be redefined to a higher value since exactly 1000 as a limit is probably a chosen limitation, not a result of some calculation.

Kimvais
while there is an if statement to check whether or not the user inputs greater than 1000 for "how many pictures to capture", it is only followed by the malloc... the char is a pointer, btw... so I am guessing each char is brightness data for a pixel... so I guess if that is the case, then just changing the if statement should work, but I will take a look again and try it out, and post code if needed, thanks so far!
nmz787
Yes, just the IF statement should be enough. You might want to check the available memory and how much the program takes when taking 1000 pictures and adjust the new value to such that there is enough memory. (e.g if taking 1000 pictures consumes 200 megabytes and you have 2 gigabytes, 8000 pictures should be quite safe)
Kimvais