Beispiel #1
0
/*!
 * @brief キャラクタダンプを作って BUFに保存
 * @param dumpbuf 伝送内容バッファ
 * @return エラーコード
 */
static errr make_dump(BUF* dumpbuf)
{
	char		buf[1024];
	FILE *fff;
	char file_name[1024];

	/* Open a new file */
	fff = my_fopen_temp(file_name, 1024);
	if (!fff)
	{
#ifdef JP
		msg_format("一時ファイル %s を作成できませんでした。", file_name);
#else
		msg_format("Failed to create temporary file %s.", file_name);
#endif
		msg_print(NULL);
		return 1;
	}

	/* 一旦一時ファイルを作る。通常のダンプ出力と共通化するため。 */
	(void)make_character_dump(fff);

	/* Close the file */
	my_fclose(fff);

	/* Open for read */
	fff = my_fopen(file_name, "r");

	while (fgets(buf, 1024, fff))
	{
		(void)buf_sprintf(dumpbuf, "%s", buf);
	}

	/* Close the file */
	my_fclose(fff);

	/* Remove the file */
	fd_kill(file_name);

	/* Success */
	return (0);
}
Beispiel #2
0
void mut_do_cmd_knowledge(void)
{
	FILE *fff;
	char file_name[1024];

	/* Open a new file */
	fff = my_fopen_temp(file_name, 1024);

	/* Dump the mutations to file */
	if (fff) mut_dump_file(fff);

	/* Close the file */
	my_fclose(fff);

	/* Display the file contents */
	show_file(TRUE, file_name, T("Mutations", "突然変異"), 0, 0);

	/* Remove the file */
	fd_kill(file_name);
}