• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

C --> Java

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I need to read within Java code a binary file which was written using 'fwrite' method in 'C'.
More specifically I wish to translate the following C code into Java code.
Thanks to anyone who could help.
static int lecture_p1 ( ) {
int ptp1;
if ((pfp1 = fopen(PCP1, "r")) == NULL) {
perror(PCP1);
exit();
}
fread((char * ) &ptp1, sizeof(int), 1, pfp1);
fclose(pfp1);
return ((long) ptp1);
}
 
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Murat,

Hope this helps
 
No matter. Try again. Fail again. Fail better. This time, do it with this tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic