Newer
Older
access-test / modules / src / test_write.c
Nomura Kei on 30 Nov 2022 812 bytes from svn
/**
 * @file	test_write.h
 * @brief	write テスト
 * @author	Nomura Kei
 * @copyright 2008  Nomura Kei
 */
#include <stdio.h>
#include <test_write.h>


/**
 * 指定されたパスが書込可能か確認します。
 *
 * @param pathname パス
 * @return true/false (書込可能/書込不可)
 */
bool can_write(const char* pathname)
{
	bool is_success = false;
	FILE* fp = fopen(pathname, "w");
	if (fp != NULL)
	{
		is_success = true;
		fclose(fp);
	}
	return is_success;
}


/**
 * 指定されたパスが追記可能か確認します。
 *
 * @param pathname パス
 * @return true/false (追記可能/追記不可)
 */
bool can_append(const char* pathname)
{
	bool is_success = false;
	FILE* fp = fopen(pathname, "a");
	if (fp != NULL)
	{
		is_success = true;
		fclose(fp);
	}
	return is_success;
}