Discuz! Board

 

 

Search
Discuz! Board Forum Integration Questions 怎么读取二进制文件
View: 1743|Reply: 19
go

怎么读取二进制文件

Rank: 2

Post on 2011-10-28 17:18 |All posts
读取二进制文件怎么读  有方法直接将读取文件的数组转为字节数组吗  txt文件中有中文怎么读取 能写个读取二进制文件返回的数组的操作吗
类似java流的操作有吗读取二进制文件怎么读  有方法直接将读取文件的数组转为字节数组吗  txt文件中有中文怎么读取 能写个读取二进制文件返回的数组的操作吗
类似java流的操作有吗

Rank: 4

Post on 2011-11-1 12:20 |All posts
c_res_file open a file in res folder (in the apk),
c_file_open opens a file in phone's file system (not in apk).

str = c_file_op(C_FILE_READ, file_handler) can do reading.
Return value is an Array. If you trace it, trace(str); it is like "abcde"
each element is a byte. str[0] is "a", str[1] is "b"

Chinese is the same

Rank: 2

Post on 2011-11-2 11:39 |All posts
Return value is an Array. If you trace it, trace(str); it is like "abcde"
如果不是“abc”  如果是“中国”
each element is a byte. str[0] is not  "中", str[1] is "国"

Rank: 2

Post on 2011-11-2 11:42 |All posts
在问你个问题  图片有镜像旋转吗

Rank: 2

Post on 2011-11-2 11:54 |All posts
其实二进制文件存的是ascii码  比如“中”用204 和265表示   str[0] is "204", str[1] is "265"
怎么转为“中”

Rank: 4

Post on 2011-11-3 10:42 |All posts
Reply veyan1314 's thread

node.scale(-100,100),你看是不是你要的效果

Rank: 2

Post on 2011-11-3 11:27 |All posts
Reply 赵韬 's thread

可以了  图片的宽高可以得到不

Rank: 4

Post on 2011-11-3 13:41 |All posts
Reply veyan1314 's thread

转为“中” 然后做什么,总的目的是什么?

问这个是因为目前所有游戏中还没出现这类需求。本地文件只存某些状态变量。数据基本存后台。

Rank: 2

Post on 2011-11-3 14:05 |All posts
Reply 赵韬 's thread

如果我直接用lnode.addlable(“中”)乱码  excel表文件  有道具描述 我们用java写的工具 用流writeutf(“道具描述”)保存的二进制文件 基本都是这种文件存储方式  地图编辑器也是这样的数据 我只想知道可以读这样的文件不 我现在把这样的文件按{"0":"5.28","1":"img1","2":"ani1","3":"0","4":"100"}按这种格式存储txt可以读取  你说的后台是哪里,所有游戏数据都是本地文件存储的。

Rank: 2

Post on 2011-11-3 14:08 |All posts
下次回答  先把我这两个问题回答下 1:图片宽高怎么获取2:有能保存new A()如这样自定义的类对象的容器吗 如vector之类
Security Q&A Change Security code Change

Archiver|Comsenz Inc.

All time is GMT+8, 2013-5-25 09:16 , Processed in 0.033448 second(s), 10 queries .

Powered by Discuz! X1.5

© 2001-2010 Comsenz Inc.