50 lines
928 B
C
50 lines
928 B
C
#include <stdio.h>
|
|
int hidden_message(const char *filename, const char delim){
|
|
|
|
FILE *file = fopen(filename, "r");
|
|
if(!file) return 1;
|
|
|
|
|
|
int c = fgetc(file);
|
|
printf("%c", c);
|
|
//char *cara = c;
|
|
|
|
while(c != EOF){
|
|
|
|
c = fgetc(file);
|
|
if( c == delim){
|
|
c = fgetc(file);
|
|
printf("%c", c);
|
|
}
|
|
}
|
|
fclose(file);
|
|
return 0;
|
|
|
|
|
|
}
|
|
/*
|
|
int main()
|
|
{
|
|
hidden_message("example.txt", ':'); // Must return 0.
|
|
// Must print nook
|
|
|
|
putchar('\n');
|
|
|
|
hidden_message("example.txt", ';'); // Must return 0.
|
|
// Must print: n
|
|
// Because no delimiter was found, so only the first character is printed
|
|
|
|
putchar('\n');
|
|
|
|
hidden_message("does_not_exist.txt", ':'); // Must return 1.
|
|
// Must not print anything
|
|
|
|
// FLAG
|
|
//Decode the given message to understand what it means
|
|
//
|
|
hidden_message("flag.txt", '~');
|
|
|
|
return 0;
|
|
}
|
|
*/
|