我在C处有一份双手文件,我希望在java读。 我在C文中写道:
void Log(TCHAR *name,int age){
write_int(file, 2012);
write_int(file, 4);
write_int(file, 16);
write_int(file, 12);
write_int(file, 58);
write_int(file, 50);
fwrite(&name, sizeof(name), 1, file);
fwrite(&age, sizeof(age), 1, file);
fflush(processusFile);
}
Java http://www.heatonresearch.com/code/22/BinaryFile.java"rel=“nofollow”http://www.heatonresearch.com/code/22/BinaryFile.java。
RandomAccessFile f = new RandomAccessFile("myfile.dat", "r");
BinaryFile binaryFile = new BinaryFile(f);
ArrayList<String> text = new ArrayList<>();
while (true) {
try {
Calendar calendar = new GregorianCalendar();
int year = (int) binaryFile.readDWord();
int month = (int) binaryFile.readDWord();
int date = (int) binaryFile.readDWord();
int hourOfDay = (int) binaryFile.readDWord();
int minute = (int) binaryFile.readDWord();
int second = (int) binaryFile.readDWord();
calendar.set(year, month, date, hourOfDay, minute, second);
System.out.println(binaryFile.readFixedString(64));
catch (Exception e) {
break;
}
}
这不是为果园而工作,而是为果园而工作。 我怎么能写一下强势?