Page 1 of 1

Help required, please.....

Posted: Sun Oct 10, 2010 6:16 pm
by willo
Having last attempted basic programming about thirty years ago, I am in need of some assistance with a program I am trying to write.

After user input of a number, I want the program to create a file for it. (Easy, I can do that bit of it!) Then I want successive inputs to be entered into the file but, before doing so, if any data in the file is of less value then I want that data to be deleted. I also want the computer to let me know if any data in the stored file is of the same value as the current input before it is put into the file, and how many times it already exists there.

I'm not sure QB64 is capable of doing this, all I know is the more I try to work it out the more my head hurts!

Any help would be greatly appreciated.

Posted: Sun Oct 10, 2010 7:40 pm
by burger2227
Your best bet is to use arrays to work with the data. Load the file data and make your changes in the array data. When the program is done, use FOR OUTPUT AS #? to clear the file and write all of the data in the array to the file again.

Qbasic is limited in the amount of data it can work with. If you exceed the limits, you could lose everything so have a backup file too!

QB64 allows you to copy an array directly to a BINARY file in one PUT. In fact arrays can hold over 100 thousand values too! Simply PUT #1, , Array(). To restore the array when the program starts, just use one GET #1, , Array() and work from there.

It also allows you to increase the array size if needed by using REDIM _PRESERVE Array(UBOUND(Array) * 3 / 2). Just use the lowest index or another file to hold the array size so that the program knows the size of the array needed before the GET.

QB64 uses Qbasic keywords so it should be able to compile most programs and they can even be run on 64 bit PC's. The link is in my signature.

Ted

Posted: Tue Oct 19, 2010 11:21 am
by willo
Thanks for your good advice, Ted. I think I need to do some more revision on the use of arrays.

Very grateful.

Brian

Posted: Wed Oct 20, 2010 12:47 am
by Anonymous
what are metacommands? give me some examples.
Is there any feature that'll allow the
program to not to display it's button on taskbar. do you have any?

how to treat depression

Posted: Wed Oct 20, 2010 5:18 am
by Theunis
1.) Did You try a search for Metacommands.
The following result showed up: Valerie : PostPosted: Fri Aug 26, 2005 8:12 pm : The BC compiler options and metacommands are here:

http://qbcm.hybd.net/issues/1-9/#letters

Unfortunately I cannot publish the two pages of the QB4.5 manual here.

2. Button on task bar: This is a Windows feature. I don't know how to disable it.

3. Please remember we assist with programming problems. Your question is more in line with tutoring. Download Teds program, Check the tutorials on Pete's site etc.