Click here to Skip to main content
15,888,337 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

I want to send and receive images in C programming. What are all the datatypes that can use to store any number of image size(even in MB). Right now i am using int and i am able to read and write with very small size i have also tried long long int.. but that is also not working. Are there any possible ways
Posted

1 solution

There is only one thing covering all arbitrary images and other big objects is array of char. As this is "plain C" (not C++), one (related) structure to use is… FILE. See, for example: http://www.cprogramming.com/tutorial/cfileio.html[^].

You also should understand that char is not the character. In modern terms, it is only the character in the sense of C which assumes that characters are represented as 8-bit (or 7-bit, which high bit ignored) values, which is not presently the case. Data consists of bytes.

I have no idea what have you done with int and what did you plan to do with long long int, probably something making no sense at all.

—SA
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900