1

Have to create a fd to a path in java that need to be used in a c++ code.

I don't want machanism for IPC, I wanted to know way to create a fd in java that is compataible to be open and write in c++ side.

When i create a fd in java it is like java.io.FileDescriptor@89b7516 , so how do i open it in c++ and write into it ?

File file = new File(filePath);
if (!file.exists()) {
    file.createNewFile();
}
FileOutputStream output = new FileOutputStream(file);
FileDescriptor fd = output.getFD();
wohlstad
  • 12,661
  • 10
  • 26
  • 39
Amruth A
  • 66
  • 5
  • 17
  • See [Most efficient way to pass Java socket file descriptor to C binary file](https://stackoverflow.com/questions/11455803/). It is written with a socket in mind, but the answer also applies to a file, too. – Remy Lebeau Jan 22 '23 at 10:15

0 Answers0