txt中的数据为用matlab将图像转为二进制存入txt文件当中,存入的时候txt中的数据为一维,怎样可以在C当中将改txt文件进行读取,然后转为一维数组,方便进行调制解码。求大神指导
一部分数据为:
000000010000000100000001000000010000000100000001000000010000000100000001000000010000000100000001000000010000000100000001000000010000000100000001000000010000000100000001000000010000000100000001000000010000000100000001000000010000000100000001000000010000000100000010000000010000000000000000000000000000000100000010000000100000000100000001000000010000001000000011000001000000010000000100000000100000010000000100000000110000010000000010000000010000001000000010000000100000001000000010000000100000001000000010000000100000000000000000000000010000000100000000000000000000000000000001000001000000010000000101000001100000011000000111000010000000100000001000000010000000100000001000000010000000100000001001000010010000101000001011000011000000110100001101000011010000111000001110000011000000110100001101000011100001000000010001000100100001001100010100000101100001011100010110000110000001110000011110000111110010001100101000001010100010111000110011001110100100001001001001010011100101100101100001011001110110111001110011011110011000010110001010100011101001000110010000100011111000111110001111100011101000110110001100100010111000111010001100100010111001000010001101100011111000111010010001100100101001001010010011100101011001010010010011100110001001011010010111100110001001100110011100100101001001010110010011100011111000100010000111100000110111101101111010011101110111011001110001011011100110110001100110011000110110001001011100010101110101100001010010010001000011101100110011001010100001111000011000000011110000100100000100000000000000000000000011
更多0
1.fopen函数打开需要读取的文本,获取该文件的文件描述符
2.使用fscan()函数对文件进行读取。
3.放到二维数组其实就是读取相应格式的数据,然后对应数组的每个位置
4.文件中的二进制数据跟正常的数据是没有区别的。区别在于如何去输出他们。
比如在文件中二进制数据是 0x0A.你读到内存中其实还是以0x0A 存储的。如果直接输出
其值那就是0x0A。如果输出其ASCII码就是一个换行符了。
例如
#include "stdio.h"