有哪些数据类型可用于发送n个字符 [英] What are the data types that can be used to send n no of characters

查看:99
本文介绍了有哪些数据类型可用于发送n个字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我想用C编程发送和接收图像。什么是可用于存储任意数量的图像大小的数据类型(即使以MB为单位)。现在我正在使用int,我能够以非常小的尺寸进行读写,我也尝试了很长的int ..但这也无效。是否有任何可能的方法

解决方案

只有一件事覆盖所有任意图像,其他大对象是 char 。因为这是普通C(不是C ++),所以使用的一个(相关)结构是...... FILE 。例如,请参阅: http://www.cprogramming.com/tutorial/cfileio.html [ ^ ]。



您还应该了解 char 不是该字符。在现代术语中,只有C意义上的字符假定字符表示为8位(或7位,高位忽略)值,目前不是这种情况。数据由字节组成。



我不知道你用 int 做了什么,你打算做什么使用 long long int ,可能完全没有任何意义。



-SA

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

解决方案

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


这篇关于有哪些数据类型可用于发送n个字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆