helped need from new library!

Announce and discuss the progress of your various programming-related projects...programs, games, websites, tutorials, libraries...anything!

Moderators: Pete, Mods

Post Reply

How can I be SO awesome?

magic
1
17%
aliens
3
50%
genetic eingeneering
2
33%
 
Total votes: 6

zanzibar
Coder
Posts: 21
Joined: Tue Feb 28, 2006 10:03 pm

helped need from new library!

Post by zanzibar »

Well, I finally decided to create a library. No, not a gaming library. This is a new idea...

presenting WLib! (WongLib, my last name is Wong)

It provides routines that allows you to easilly navigate your directories. Files, folders, memory, extensions, etc. Any ideas?

what do you want to be in the lib? any specific needs?
Last edited by zanzibar on Thu Mar 02, 2006 11:27 am, edited 1 time in total.
zanzibar
Coder
Posts: 21
Joined: Tue Feb 28, 2006 10:03 pm

documentation

Post by zanzibar »

WongLib ver 1.0
all right reserved. (not really) ;-)
a library devoted to exploring and manipulating files and folders from within you qbasic program!

Hurray!
I've finally decieded to make a library. As of now, it's just a baby, with only 4 commands. I know the qBasic comunity will support newcomers, so I hope you'll contribute! The current commands probably aren't perfect yet, but exams are killing me...

Why I made it:
because I hate hardcoding paths in! IT SUCKS! Programs need a GUI! call me a heretic but I believe it!
Anyways, now users can navigating the startling realms of their computer from a qbasic program. If you ever wanted to make a fake OS, now's is a great chance.
It is still uncompiled! Just load the files, there is need to make real library files, for right now, anyways.
Basically, I disected dir.bas from qbasic.com and figured out how it worked. Then, I wrote my own methods. So if you wrote the original, kudos and thanks, whoever you are.


What I want from you:
This will be an open source project! So, I need your input and ideas. Becuase it's so small right now and not ready to leave the nest, I'm not releasing it. after a few versions, you'll get it!
Anyways, think about your old projects and how WongLib could improve them. Then give me your ideas!

CURRENT METHODS:

1) wPrintDir() - outputs text file of all directory info
2) wFiles$(path$, num, type$) - return the path of the file of type type$ in the numth albhabetical position in directory path
3) wFolders$(path$, num) - return the path of the folder in the numth albhabetical position in directory path
4) wMemAvail() - amount of memory in file left


INCOMPLETE / FUTURE METHODS:

1) wFilesUlti$(path$, num, type$) - wFiles$, but searches in every directoy beneath, as well as path$
2) wMemUsed() - amount of memory used
3) wNum(path$, type$) - number of files of type Type$
4) wNumUlti(path$, type$) - wNum(), but searches every direcotry beneath as well as path$
5) wExist(path$) - returns true if file exists, 0 if not
6) wType(path$) - return type$ of file
7) wCopy(path$) - creates copy of file/folder
8) wMove(path$) - moves a file/folder
9) wDelete(path$) - delete's a file/folder
10) wDeleteOK(path$) - instead of delete, moves file to a secure location. usefull for debugiing, so you never accidentally fry you file!


* fix methods so they can pass in a wild type$, to access all types of files.
* run-time error checking
*** AND ANYTHING ELSE YOU HEART SO DESIRES!!!

All about me, or
Why I am so amazing:

I'm a comp sci freshman at University of SOuth Carolina. I actually hate Windows. I love my powerbook but I use the crap machines at school just because I have a soft spot for QBasic. ain't it great?!

Darklink246@alltel.net
User avatar
Zim
Veteran
Posts: 98
Joined: Mon Dec 05, 2005 4:31 pm
Location: Wisconsin, USA
Contact:

Post by Zim »

This sounds great!

I once wrote a couple of subs (for qb3). They were called ifexist() and fopen(). The purpose was to determine if a file (with user specified name) existed as specified, and to actually open it if possible, but WITHOUT returning an error.

Normally one would compile the program with error checking turned on, then jump to an error handling routine if the file didn't exist or couldn't be opened for whatever reason. Compiling with error checking made my program exe's larger and slower.

My workaround was to place such routines (subroutines) into separate modules and compile them separately WITH error checking. Then link them (as objects or libraries) to main code which had been compiled WITHOUT error checking. This prevented the whole program from being larger and slower, just a small part would be larger and slower.

This library is something I would use provided I could use them WITHOUT error checking turned on!
--- Zim ---
--- Time flies like an arrow, but fruit flies like a banana ---
zanzibar
Coder
Posts: 21
Joined: Tue Feb 28, 2006 10:03 pm

Post by zanzibar »

well error checking would be the last part I implement. perhaps even pass in a variable that decides whether or not to use error checking for each specific routine? hmmmm...

any ideas for specific funtions, though?

my basic strategy is to open the hided directory file, in each folder, then by way of string maniputlation, extract the needed info. It's not exactlly perfect but getting better but I can't find any better methods.

if you know of a better strategy or a related file / tutorial, tell me!
Patz QuickBASIC Creations
Veteran
Posts: 399
Joined: Wed Mar 02, 2005 9:01 pm
Location: Nashville, Tennessee
Contact:

Post by Patz QuickBASIC Creations »

Create a function that can encrypt/decrypt files quick and archiving! Put fast archiving in and I will use it in NOGOSH as long as it's PDS friendly :-D
zanzibar
Coder
Posts: 21
Joined: Tue Feb 28, 2006 10:03 pm

Post by zanzibar »

ummmm...

anyways, those ideas sound great but my current method doesn't seem to work so well...

I open the dir.tem file and read the strings out. I think there might be a better way, though. it's pretty slow and it can be unreliable. is there a better way to read directory info into qBasic?

check out dir.bas out qbasic.com
http://www.qbasic.com/mirror/files/dir.bas
Patz QuickBASIC Creations
Veteran
Posts: 399
Joined: Wed Mar 02, 2005 9:01 pm
Location: Nashville, Tennessee
Contact:

Post by Patz QuickBASIC Creations »

darklink246 wrote:ummmm...

anyways, those ideas sound great but my current method doesn't seem to work so well...

I open the dir.tem file and read the strings out. I think there might be a better way, though. it's pretty slow and it can be unreliable. is there a better way to read directory info into qBasic?

check out dir.bas out qbasic.com
http://www.qbasic.com/mirror/files/dir.bas
Hmmmmm...
It matters what exactly you mean by directory info... I usually find the DIR$() function pretty useful for this type of thing. EX. to read a directory's contents...

Code: Select all

' Pseudo-code, may have a couple of syntax errors.
'Also, PATH$ MUST have a following \ or else your directory
'structure will be messed up.
SUB Dir2File(PATH$, OUTPUTFILE$)
LET FilNum = FREEFILE
OPEN OUTPUTFILE$ FOR OUTPUT ACCESS WRITE AS #FilNum
LET TempStor$ = DIR$(PATH$+"*")
PRINT #FilNum, TempStor$
While TempStor$ <> ""
Let TempStor$ = DIR$()
PRINT #FilNum, TempStor$
WEND
END SUB
This could probably be shortened somehow, but I don't have a QB window open... (BTW I don't think DIR$() exists in QB45...)
Post Reply