// ConsoleApplication1.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include <windows.h>

FILE *f1;
void * data;

int main(int argc, char *argv[])
{
	int salida = 0;
	int buffer[50];

	data = GetModuleHandleA("kernel32.dll");



	while (salida != 0x41424344) {

		f1 = fopen("fichero.dat", "a+");
		if (f1 == NULL)
		{
			perror("No se puede escribir fichero.dat");
			printf("%x", data);
			return -1;
		}

		fgets((char *)buffer, 450, stdin);


		fwrite(buffer, 1, 450, f1);

		salida = buffer[0];
		fclose(f1);
	}


	return 0;

}






