本文介绍了自适应数据类型(或者......)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好的,我遇到了一个大问题。我想要做的基本上是从

文件中读取。该文件包含符号。用户指定一个符号需要多少字节

。例如,在一个文本文件中,每个符号需要一个字节为
。所以我想读入一个数组,比如buf [],是buf [0]

包含第一个符号,b [1]包含第二个符号,依此类推。

我怎么意识到这一点?我的意思是,该程序必须能够处理每个符号的任何

字节数。例如:


file content =" 123456789"


示例#1。每个符号的字节数= 1.

在这种情况下,

buf [0] = 1

buf [1] = 2

buf [2] = 3




示例#2,每符号字节数= 2.

在这种情况下,

buf [0] = 12

buf [1] = 34




任何想法怎么做,伙计们?

Ok, I got a big problem. What I want to do is basically read from a
file. This file contains "symbols". The user specifies how much bytes
one symbols need. For example, in a a text file each symbol would need
one byte. So I want to read into an array, say buf[], were buf[0]
contains the first symbol, b[1] the second, and so on.
How do I realize that? I mean, the program has to be able to handle any
number of bytes per symbol. For example:

file content = "123456789"

example #1. bytes per symbol = 1.
In this case,
buf[0] = 1
buf[1] = 2
buf[2] = 3
etc.

example #2, bytes per symbol = 2.
In this case,
buf[0] = 12
buf[1] = 34
etc.

Any idea how to do this, guys?

推荐答案



几个,但我不知道如何选择它们。

你想用这些符号做什么? ;在他们将
加载到阵列后?


-


Several, but I don''t know how to choose among them.
What do you want to do with these "symbols" after they
have been loaded into the array?

--
Er*********@sun.com





请为上下文引用足够的上一条消息。看看

小组中的其他人是怎么做的。

你还没有解释你想要完成什么。什么是这些

符号?创建数组后如何使用它们?


Brian


Please quote enough of the previous message for context. See how
everybody else in the group does it.
You haven''t explained what you are trying to accomplish. What are these
"symbols"? How will they be used once you create the array?

Brian


这篇关于自适应数据类型(或者......)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-19 18:29