Ive been looking into a Basic 'Debug' Text Filebrowser just for informational purposes on structures and how to point to a value in one (->) and so Im making a simple filebrowser in the DOS printf debug statements...
So far I can:
~Get how many files are in a folder
~List them with file numbers
~Read files line-by-line and print them to screen
Code:
Directory -> C:/cygwin/home/owner/resources
Files in Directory:
0->.
1->..
2->cheatbook.c
3->DRAGON1.CPP
4->Filelist.c
5->filing.exe
6->flib.c
7->flib.h
8->line.c
9->line.exe
10->mp3player.c
11->mp3player.h
12->puttytel.exe
13->replace.c
Thats what is printed out when in my working directory,
I need to know where i can go to learn more (or maybe you guyz post an example? but I heard you cant help me via direct code) about how to 'cd' into directories and such...
Another thing is I want to know how to 'select' things on the browser. Like have 'up' move a highlightening color of the text up 1 in the list, that way I can read the file's easy...
If you want to see my code, ill post it here, maybe someone could tell me if it is suffienct enough?
P.S. This viewing function has worked for me before perfectly, but now it isnt... Could someone tell me whats wrong?
Code:
void FileRead(char* FilePath) {
FILE *fp;
fp = fopen(FilePath, "r");
char line[MAXLINE];
int count = 0;
printf("Now Opening: %s\n", FilePath);
while ( fgets(line, sizeof line, fp) != NULL)
{
printf("%2d | %s\n", ++count, fp);
}
}
It prints like 13 lines with 3 characters of binary or soemthing, and when i put a '*' infront of the 'fp' in the while loop, i get the file's stuff, but like a billion times... the ratio is for every '1' line (the number is placed next to the line), it prints out 15 lines of actual code, and there all jumbled around too...
Anyhelp would be great