• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

File Descriptor

 
Steven Wong
Ranch Hand
Posts: 295
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Can anyone show me how to make use of a FileDescriptor?
For eg. how do I replace it for the parameter of the FileInputStream constructor?
FileInputStream inputStream = new FileInputStream("C:/test.txt");
...
...
Thanks
 
Mario Levesque
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Clement,
I'm not too sure about what you are asking exactly, however I found this on the web that might help you.

http://mindprod.com/io10.html
Good Luck.
Mario
 
Steven Wong
Ranch Hand
Posts: 295
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got it oredi, Mario.
Thanks.

public static void main(String a[])
{
try
{
FileDescriptor fd = new FileDescriptor();
FileInputStream fI = new FileInputStream(fd.in);
FileOutputStream fO = new FileOutputStream(fd.out);
int c;
while((c=fI.read()) != -1)
{
fO.write(c);
}
}
catch(IOException e){e.printStackTrace();}
}
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic