(Un)compatibility between files generated from C++ and Java

Discussion in 'Java' started by Maria, Dec 17, 2004.

  1. Maria

    Maria Guest

    Hi
    is there (Un)compatibility between files generated from C++ and Java?
    i think there is since the datatypes can have different
    representation. In Java for instance integer type takes 4 bytes,
    whereas it is just 2(i think!) in C++
    so when writing in a language and reading the generated integer file
    with other language mismatch occurs?

    what about strings-type files (un)comaptibility between the two
    languages?

    is it worse between Java (C++) and Cobol/pascal?

    if you can give me examples i 'll be delighted :)

    thanks
    Maria, Dec 17, 2004
    #1
    1. Advertising

  2. Maria <> scribbled the following:
    > Hi
    > is there (Un)compatibility between files generated from C++ and Java?
    > i think there is since the datatypes can have different
    > representation. In Java for instance integer type takes 4 bytes,
    > whereas it is just 2(i think!) in C++
    > so when writing in a language and reading the generated integer file
    > with other language mismatch occurs?


    > what about strings-type files (un)comaptibility between the two
    > languages?


    > is it worse between Java (C++) and Cobol/pascal?


    > if you can give me examples i 'll be delighted :)


    Files do not carry inherent notions of what created them. The exact same
    kind of file can be created by Java, C++, COBOL, Pascal, assembler,
    whatever.
    It is true, as you say, that Java and C++ can have different-sized
    integers, but this is not a problem. As long as you realise what sizes
    different languages have for integers, you can develop a system of
    always writing integers the same way. Every language has a way of
    writing individual bytes. Just use this to write integers in a uniform
    way across languages.

    --
    /-- Joona Palaste () ------------- Finland --------\
    \-------------------------------------------------------- rules! --------/
    "B-but Angus! You're a dragon!"
    - Mickey Mouse
    Joona I Palaste, Dec 17, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. bucket79
    Replies:
    1
    Views:
    735
    Arne Koewing
    Aug 21, 2003
  2. Mike Kent
    Replies:
    2
    Views:
    315
    Mike Kent
    Dec 30, 2003
  3. Adi
    Replies:
    2
    Views:
    270
  4. Ruskin
    Replies:
    2
    Views:
    133
    Aaron Bertrand [MVP]
    Apr 15, 2004
  5. Tammo Tjarks
    Replies:
    3
    Views:
    109
    Wolfgang Nádasi-Donner
    Sep 9, 2007
Loading...

Share This Page