/**
 * The only process we are really guaranteed to have is this test process itself.
 * This test uses the generic filter function.
 */
TEST( Process_List_Test, find_our_process_CI_as_used )
{
  std::vector< PROCESSENTRY32W > v ;
  initialize_process_list( v, process_by_any_file_name_CI( file_name_set( multiple_exe_names ) ), copy_all() ) ;
  size_t size( v.size() );
  EXPECT_EQ( 1u, size );    // Please, don't run multiple test executables simultaneously
  ASSERT_GE( 1u, size );
}
Exemple #2
0
int main(int argc, char const *argv[])
{

	FILE *test_file;
	char file_text[max_array_length];
	char file_path[max_array_length];
	char file_name[max_array_length];
	char write_temp[max_array_length];


	//检测参数是否匹配,并获得对应的文件名
	if (argc > max_parameter)
	{
		printf("对不起!你的参数输入有误!请重新输入!\n");
		file_name_set(file_name);
	}
	else if (argc == max_parameter)
	{
		file_name_cpy(file_name, *(++argv));
	}
	else if (argc == 1)
	{
		file_name_set(file_name);
	}

	//获得文件的路径
	getcwd(file_path, sizeof(file_path));
	strcat(file_path, dir_sign);
	strcat(file_path, file_name);

	//检测文件是否存在,若存在就以读写方式打开
	test_file = fopen(file_path, "r+");
	if (test_file == NULL)
	{
		printf("对不起,你输入的文件不存在!");
		return 1;
	}

	//读出文件内容
	while (fgets(file_text, max_array_length, test_file) != NULL)
	{
		puts(file_text);
	}

	//把文件指针指向文件开头准备写文件
	rewind(test_file);
	printf("加入你要写入的内容:");
	scanf("%s", write_temp);
	fputs(write_temp, test_file);

	//把文件指针指向文件开头,再次读出写入的文件
	rewind(test_file);
	while (fgets(file_text, max_array_length, test_file) != NULL)
	{
		puts(file_text);
	}

	//关闭文件
	fclose(test_file);
	printf("\n");

	return 0;
}