On Driver and low-level Programming

 


- Okay yeah, that was definitely the issue I was getting, which I got around by changing the if statement to: if(compare(file.filename, path + 1) == 0)

This is the result I get when I do ls -la and cat TEST.TXT:

ls -la
total 4
drwxr-xr-x 2 star star    0 Dec 31 1969  .
drwxr-xr-x 2 root root 4096 Nov 22 16:08 ..
drwxr-xr-x 2 star star  101 Dec 31 1969  TEST.TXT

cat TEST.TXT
(none)

- Seems like it's not copying the memory correctly. If you know the blocks in memory that the FAT is directing the requests to, you can print them out.

test.txt is a "hello world" program.

cat TEST.TXT
#include <stdio.h>
int main(int argc, char *argv[]) {
    printf("Hello World\n");
    return 0;
}

- Well, here's my current read, with the printf statements I put in place to try to check where things went wrong:

PROGRAM

- Printing out those statements is only useful for determining "breakpoints". You'll want to print out the file_position value.

PROGRAM

- Okay I just put in those print statements, and none of them printed.

...

...

- So where's your... like, anything, in here? This is just -d output.

- [I commented out my print statements]

- [Your code again?]

- It's quite clear that the for for loop never executes. Or if it does, that it's somehow extra broken. You might want to work on checking the condition that's in the for loop.

PROGRAM <

PROGRAM <=

- You know. It's a <= and a <=.

- [Why do I say that? I've read the .meme file with my eyes. The file is stored in block[1] of the directory.]

- "<=" is c code for "less than or equal to".

- [Here's the output.]

...

- Instead of file_position you might want to add a 2nd iterating variable to show what block you're at. First, second, third block. But starting at 0 so 0th, first, second, third block and so on. That's what you would use to calculate start and end bytes.

- Like this.

PROGRAM

- That worked.

cat TEST.TXT
#include <stdio.h>
int main(int argc, char *argv[]) {
    printf("Hello World\n");
    return 0;
}


Comments

Popular Posts