Hi,
Just starting to reacquaint myself with the QL (well QPC/SMSQE) and have hit a problem or a misunderstanding on my part.
After setting up several DEV associations, e.g.
DEV_USE 1,WIN1_SOFTWARE_
DEV_USE 2,WIN1_SOFTWARE_TOOLS_
DEV_USE 3,WIN1_XCHANGE_
I've tried to use DEV_NEXT, which I assumed would return the next dev in the list, so PRINT DEV_NEXT(1) would return 2. However, whatever I pass as a parameter I get zero returned.
What am I missing here?
Regards, Jon
QPC2 and DEV_NEXT
-
- RWAP Master
- Posts: 2834
- Joined: Sun Nov 28, 2010 4:51 pm
- Location: Stone, United Kingdom
- Contact:
Re: QPC2 and DEV_NEXT
Looking at my SBASIC/SuperBASIC Reference Manual, you have misunderstood how the DEV device works.
Taking your example:
DEV_USE 1,WIN1_SOFTWARE_
DEV_USE 2,WIN1_SOFTWARE_TOOLS_
DEV_USE 3,WIN1_XCHANGE_
DIR DEV1_ will actually perform: DIR win1_SOFTWARE_
DIR DEV2_ will actually perform: DIR win1_SOFTWARE_TOOLS_
DIR DEV3_ will actually perform: DIR win1_XCHANGE_
PRINT DEV_NEXT (1) will return 0 at the moment.
However, if you want to use the DEV device to search for an item, then you need to create a chain. The full syntax is
DEV_USE n,directory [,dev_next]
So to achieve what you want, you need to link DEV1 and DEV2, using:
DEV_USE 1,WIN1_SOFTWARE_,2
OPEN_IN #3,dev1_test
will then try to open WIN1_SOFTWARE_test and if not found, will then look for WIN1_SOFTWARE_TOOLS_test
At this stage
PRINT DEV_NEXT(1) will return 2.
PRINT DEV_NEXT(2) will still return 0 as there is no chain attached to DEV2_
Taking your example:
DEV_USE 1,WIN1_SOFTWARE_
DEV_USE 2,WIN1_SOFTWARE_TOOLS_
DEV_USE 3,WIN1_XCHANGE_
DIR DEV1_ will actually perform: DIR win1_SOFTWARE_
DIR DEV2_ will actually perform: DIR win1_SOFTWARE_TOOLS_
DIR DEV3_ will actually perform: DIR win1_XCHANGE_
PRINT DEV_NEXT (1) will return 0 at the moment.
However, if you want to use the DEV device to search for an item, then you need to create a chain. The full syntax is
DEV_USE n,directory [,dev_next]
So to achieve what you want, you need to link DEV1 and DEV2, using:
DEV_USE 1,WIN1_SOFTWARE_,2
OPEN_IN #3,dev1_test
will then try to open WIN1_SOFTWARE_test and if not found, will then look for WIN1_SOFTWARE_TOOLS_test
At this stage
PRINT DEV_NEXT(1) will return 2.
PRINT DEV_NEXT(2) will still return 0 as there is no chain attached to DEV2_
Rich Mellor
RWAP Software
RWAP Adventures
SellMyRetro
Retro-Printer Module - add a USB printer to your QL
Also Involved in:
Icephorm
RWAP Software
RWAP Adventures
SellMyRetro
Retro-Printer Module - add a USB printer to your QL
Also Involved in:
Icephorm