데블스캠프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);
Retrieved from http://wiki.zeropage.org/wiki.php/데블스캠프2005/보안
last modified 2021-02-07 05:29:00