U E D R , A S I H C RSS

데블스캠프2005/보안

실습에 필요한 파일들

fileio.cpp

~cpp 
#include <stdio.h>
#include <string.h>

void saveToFile(char *filename, char *str)
{
	FILE *file = fopen(filename, "wb");
	fwrite(str, strlen(str), 1, file);
	fclose(file);
}

long loadFromFile(char *filename, char *str)
{
	FILE *file = fopen(filename, "rb");
	fseek(file, 0, SEEK_END);
	long len = ftell(file);
	fseek(file, 0, SEEK_SET);
	fread(str, len, 1, file);
	str[len] = '\0';
	fclose(file);
	return len;
}

fileio.h

~cpp 
void saveToFile(char *filename, char *str);
long loadFromFile(char *filename, char *str);
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:29:00
Processing time 0.0150 sec