POV-Ray : Newsgroups : povray.off-topic : C++ questions : Re: C++ questions Server Time
7 Sep 2024 15:25:42 EDT (-0400)
  Re: C++ questions  
From: Nicolas Alvarez
Date: 26 Sep 2008 17:17:59
Message: <48dd5187@news.povray.org>
Warp wrote:
>   Unless I'm completely mistaken, this is not something you can achieve
> in Java. (In Java you have to close files explicitly and catch all
> possible exceptions which might otherwise bypass that closing.)

You don't have to *catch* the exception, but you do need extra code. I don't
even remember how to open a file in Java, so here's some pseudo-code:

FileStream fs = /* open a file */;
try {
    fs.write("Hello\n");
    String data = getData(); //may throw exception
    fs.write(data);
} finally {
    fs.close();
}


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.