English 中文(简体)
利用STL /POSIX将J2SE的双向文档输入手机
原标题:Loading binary file from J2SE into iOS iphone using STL / POSIX

因此,我努力支持一些遗产工具,在 Java为J2ME的发展写了字。

我需要以C++的同样格式在iphone/ipad读。 您问,为什么——和(或)需要也支持安妮·恩古克7

现在我必须获得价值,以适应,并且确信,我有权: 这里是我的 Java(J2SE)法典:-

File file = new File(location, "test.d2r");

BufferedWriter writer = new BufferedWriter(new FileWriter(file));

int i = Integer.reverseBytes(8);

writer.write(i);
writer.newLine();
writer.flush();
writer.close();

并且,在“土地”中,

NSString *url = [[NSBundle mainBundle] pathForResource:@"test" ofType:@"d2r"];

FILE* fp = fopen([url UTF8String], "r");

if (fp) 
{
    int j;
    printf("
Reading...
");

    fscanf(fp, "%c", &j);
    fclose(fp); 

    printf("DIGIT 1 %d

", j);
}
else
{
    printf("

 No file found...... 

");
}

因此,档案开了罚款,但数字没有对应。 Ive试图绕过最终用户。 唯一可以考虑的是,由于我正在从一个未签署(java)平台转换成(c++)平台,正在那里获得签字,并提升其价值。

然而,任何要点都将受到热烈欢迎。

最佳回答

<代码>fscanf为阅读文本,而非阅读数据。

请不要使用<条码>fscanf。

fread(&j, 4, 1, fp);

Futhermore, you should open the file with the option "rb" instead of "r" to indicate that you want to read a binary file. Depending on the operation system, this can be essential.

这是正确的,是 Java方面:

因此,C++一侧的Cdo 回答是混杂的,这是 Java一侧的书写作业。

BufferedOutputStream out = new BufferedOutputStream(  
                  new FileOutputStream("bob_FontTool.d2r", false));

ByteBuffer buffer = ByteBuffer.allocate(4).order(ByteOrder.nativeOrder());  
buffer.putInt(8);  
out.write(buffer.array());

out.flush();  
out.close(); 
问题回答

暂无回答




相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签