• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

C --> Java

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Murat,

Hope this helps
 
reply
    Bookmark Topic Watch Topic
  • New Topic