I think for the suppress option, I need to setup a loop that checks the amount of times '\n' is next to itself, if it's more than 1, remove the excess.
Also, I did figure out how to get a file loaded to RAM. It's a separate project from implementing flags.
Here's the code for that:
Code:
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <stdlib.h>
int main(int argc, const char * argv[])
{
uint64_t FileSize;
char *FileData = NULL;
FILE *fp = NULL;
if(argc != 2)
{
fprintf(stderr, "Please enter one file name.\n");
return 1;
}
fp = fopen(argv[1], "r");
if(fp == NULL)
{
fprintf(stderr, "No such file found.\n");
return 1;
}
fseek(fp, 0L, SEEK_END);
FileSize = ftell(fp);
rewind(fp);
FileData = malloc(FileSize);
if(FileData == NULL)
{
fprintf(stderr, "No memory avaliable!\n");
return 1;
}
fread(FileData, FileSize, 1, fp);
fclose(fp);
fwrite(FileData, FileSize, 1, stdout);
free(FileData);
return 0;
}