ras le bol
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
#include <stdio.h>
|
||||
char decode_block(int block){
|
||||
|
||||
//euh ok
|
||||
return 0;
|
||||
}
|
||||
|
||||
int print_decoded_file(const char *filename){
|
||||
|
||||
FILE *file = fopen(filename, "r");
|
||||
if(!file) return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -1 +0,0 @@
|
||||
Example
|
||||
@@ -0,0 +1,38 @@
|
||||
#include <stddef.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
void *get_data(char *filename, size_t block_size, size_t length){
|
||||
|
||||
FILE *file = fopen(filename, "r");
|
||||
if(!file) return NULL;
|
||||
|
||||
char *length_block = malloc((length * block_size) * sizeof(char));
|
||||
if( length_block == NULL){
|
||||
fclose(file);
|
||||
return NULL;
|
||||
}
|
||||
int index = 0;
|
||||
while(length != 0){
|
||||
int tmp_block = block_size;
|
||||
while (tmp_block != 0) {
|
||||
*(length_block + index) = fgetc(file);
|
||||
index ++;
|
||||
tmp_block --;
|
||||
}
|
||||
length --;
|
||||
}
|
||||
|
||||
|
||||
fclose(file);
|
||||
return length_block;
|
||||
}
|
||||
/*
|
||||
int main()
|
||||
{
|
||||
void *a = get_data("example.txt", 1, 7);
|
||||
printf("%.7s\n", (char *)a); // Prints: Example
|
||||
free(a);
|
||||
|
||||
return 0;
|
||||
}*/
|
||||
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
#include <stdio.h>
|
||||
int save_data(char *filename, size_t block_size, size_t length, void *data){
|
||||
|
||||
FILE *file = fopen(filename, "a");
|
||||
if(!file) return NULL;
|
||||
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
/*
|
||||
int main()
|
||||
{
|
||||
char *data = "This is readable text.";
|
||||
|
||||
save_data("new_file.txt", 1, 22, data);
|
||||
printf("A new file has been created.\n");
|
||||
|
||||
// FLAG
|
||||
//Analyze this serie of blood drops and convert it to DNA.
|
||||
//
|
||||
size_t t[7] = {
|
||||
7959390400869134169,
|
||||
8030516705471242340,
|
||||
4705773566797636194,
|
||||
3765928769057995296,
|
||||
4708850085609554226,
|
||||
3338648646059311435,
|
||||
5497845422045015598,
|
||||
};
|
||||
save_data("flag.txt", 1, 50, t);
|
||||
|
||||
return 0;
|
||||
}
|
||||
*/
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user