开发者

my C program has a char, and I want it to hold more data, what data type do I substitute for it?

开发者 https://www.devze.com 2022-12-16 13:55 出处:网络
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 g

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.


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消