Example: lr.redirect

In the following example the lr.redirect function instructs VuGen to redirect the Java output and error streams to the my_messages.txt file.

int rc;
lr.enable_redirection(true); 

/* Overwrite the file if it exists. If there is no file, create it. 
    If there is no "K" drive, the redirect fails. */
rc = lr.redirect ("K:\\temp\\my_messages.txt",
    "Application running!", false); 

if ( rc == lr.FAIL ) 
{
    /* Append the string to the local error file if it exists. 
        If there is no file, create it. */
    lr.redirect("d:\\temp\\VuGen_err.txt", 
        "Redirect failed!"); 
} else // Redirect succeeded.
{
    /* Write to the message to redirect
        target file on K: */
    lr.redirect("K:\\temp\\my_messages.txt", 
        "Redirect succeeded!"); 
}
lr.enable_redirection(false);