Ok, I'm a bit stuck with malloc and structs it seems >P
#include ****
#include "func.h"
int main()
{
struct fileData *fileData = (struct fileData*)malloc(sizeof(struct fileData));
fileData->filePath = "text";
printf(%c\n, *fileData->filePath);
}
In the func.h file:
#ifndef func
#define func
typedef struct fileData
{
char *filePath;
char *input;
int *numbers;
}
It only prints the first 'T' then the program stops, I cant figure out how its supposed to be, I've tried for a while now haha
what I want to do is having a struct that contains a file path picked after the program is run, then read that text file and fill char *input with the whole input then collect all the numbers from input and store it as int in numbers.. I already have the functions running tho.. i can read from a file, i just have problem getting the struct running.