Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8420531
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T02:54:14+00:00 2026-06-10T02:54:14+00:00

There is one file that was created with Objective C. In this file there

  • 0

There is one file that was created with Objective C. In this file there is an array: int[x][y]. There is no problem to read this file ‘as is’ in C and pass only link of the new int[][] as buffer.

But I want to read this file in Java, I’ve tried read it to int[x*y] but values are different because C stores a double array ([][]) not like simple [].

I think the are 2 ways: recreate file for usage in Java or use C++ in java, but maybe there are some easier ways?

UPDATED

Creation of the file (inf Objective C) (the size of array is fixed each time)

NSData *mydata = [NSData dataWithBytes:&areas length:sizeof(areas)];
[mydata writeToFile:filePathData options:NSDataWritingAtomic error:&error];
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T02:54:15+00:00Added an answer on June 10, 2026 at 2:54 am

    I imagine the problem is you are reading little endian C data as big endian. If you use DataInputStream it assumes big endian which is only the default for C on big endian machines such as Sparc 😉 and a number of machines now all but dead.

    I assume you know the format of the file and if it doesn’t contain the dimensions (width and height), you know what they are.

    I suggest you try using ByteBuffer with order(ByteOrder.LITTE_ENDIAN) to read the data. There are a number of ways to do this. If you file is smaller than 2 GB I would use a memory mapped file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am making an HTML5 game engine. There is only one file that is
In my project one ui file is there , when i am viewing that
Is there a one-liner to read all the lines of a file in Python,
I have created a screen using Objective-C in an iPhone project. In that, there
As one might expect I'm new to Objective-C and Cocoa2d so this might be
Is there a way to obtain patterns in one file (a list of patterns)
Network file systems are offered by Windows and (L)Unix. Is there one for IBM
Say I have two files where there is one number per line File 1
I'm trying to make a HTML file with command line, but there is one
Let's say there is a file called myfile.txt with the following contents: one two

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.