Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

C --> Java  RSS feed

 
Murat YILDIZ
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);
}
 
Vijayakumar Arya
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Murat,

Hope this helps
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!