QString QEb::subbookTitle2(EB_Subbook_Code code) { char title[EB_MAX_TITLE_LENGTH+1]; EB_Error_Code ecode = eb_subbook_title2(&book, code, title); if (ecode != EB_SUCCESS) { dispError("eb_subbook_title2", ecode); return QString(); } return eucToUtf(title); }
/*------------------------------------------------------------------------ -- Name: print_title_to_out_file -- -- Description: -- Print the title of the book to the output file. -- -- Parameters: -- None. -- -- Returns: -- None. -- ------------------------------------------------------------------------*/ static void print_title_to_out_file(void) { EB_Error_Code error_code; char *status_conv = NULL; FILE *out_file = NULL; /* Get the title of the subbook */ error_code = eb_subbook_title2(&book, subbook_index, title); if(error_code != EB_SUCCESS) { fprintf(stderr, "Error: Failed to get the title: %s\n", eb_error_message(error_code)); die(1); } /* Convert title from EUC-JP to UTF-8 */ status_conv = convert_encoding(conv_buf, MAXLEN_CONV, title, EB_MAX_TITLE_LENGTH, "UTF-8", "EUC-JP"); if(status_conv == NULL) { fprintf(stderr, "Error: Something went wrong when trying to encode the title\n"); die(1); } out_file = fopen(out_path, "w"); if(out_file == NULL) { fprintf(stderr, "Error: Could not open output file, \"%s\"\n", out_path); die(1); } /* Output the text to file (in UTF-8) */ fwrite(conv_buf, 1, strlen(conv_buf), out_file); fclose(out_file); } /* print_title_to_out_file */