| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | OS/2 File Viewer |
Hi... For my first somewhat successfull "real" OS/2 program, I just completed a program that views ASCII files. (I have always been annoyed at OS/2's lack of a text-mode file viewer...no more!) It lets you scroll up and down a file, page up/down, and go to beginning and end of the file. Question: Even though I've already done it, what would be the best way to allocate memory for the file you're viewing? I did it by openning the file, asking OS/2 what the size is, then calling DosAllocMem to get one big chunk. I then read it all at once with DosRead with the buffer size set to the length of the file. This seems to work great, and is fast ... even with the 1MB+ file list for OS/2 Shareware! If you guys were writing a viewer/editor, would you allocate one big chunk, or would it be best to save memory and split it up, paging the file in as necessary? Also, when accessing adjacent lines (if the user presses an arrow key) I currently search for the previous/next CR. This seems to work and isn't apparently slow, but it seems like there might be a better way. Would it be a good idea to allocate an array of pointers to the beginning of each line? That would require some setup work and more memory, but may be easier to deal with when I add more features to the program later. Overall, it works pretty well...and best of all, the EXE is an amazingly small 12K! (compiled with Watcom 10) Any ideas on the above would be appriciated. Also, would anyone be interested in having the program? I could U/L it to OS/2 Shareware if there's interest. ___ X ATP/OS2 1.42 X I used up all my sick days, so I called in dead! --- Maximus/2 2.01wb* Origin: OS/2 Shareware BBS, Fairfax, VA: 703-385-4325 (1:109/347) SEEN-BY: 12/2442 54/54 620/243 624/50 632/348 640/820 690/660 711/409 413 430 SEEN-BY: 711/807 808 809 934 712/353 623 713/888 800/1 @PATH: 109/347 2 1 3615/50 229/2 12/2442 711/409 54/54 711/808 809 934 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.