Thank, quzah. I got the file to open. Now I tried using fgets() to read a line and tried to tokenize it by using strtok(). But for some reason it's tokenizing the lines by 4 characters only. I don't know if this is allowed, but this is what I have so far,
Code:
char* line;
int main(int argc, char **argv)
{
char* file = "Smakefile";
FILE* fp = fopen(file, "rb");
line = (char*) malloc(sizeof(100));
char* token;
while(!feof(fp))
{
line = fgets(line, sizeof(line), fp);
token = strtok(line, ":");
printf("%s %d\n", token, sizeof(line));
}
}
When i run this all the tokens are broken up in 4 bytes. Oh this is the file that it's reading.
Code:
main : main.o other.o echo
gcc -o main main.o other.o
echo "Done!";
Thank you in advance again.