Code to ASSIGN (OS1.2)
4 messages in this thread
Does anyone have some code to perform an ASSIGN in C under DOS 1.2? Actually,
the minimum that I need to do is re-assign something (eg. ASSIGN C: dh1:C)
rather than create a new logical device name (eg. MyOwnNewDir:).
I have managed to find the structures that handle this in the docs that I have,
but they don't mention what you can do with those structures.
The structures I am using are: DosLibrary->dl_Root->Info->DevInfo. These names
might be a bit wrong as I don't have the code here at work – but hopefully it
gives you an idea of where I am looking.
I have tried changing the dvi_Lock to my new destination, but it Gurus the next
time the Assign is called for.
What else must I do?
Thanks.
This may not be appropriate, as I am new to C, but in the book I'm using to
learn ANSI C, there is a command called system. I've used it on the amiga with
no problem.
system(AmigaDOS command);
> system(AmigaDOS command);
There is also a similar function built into AmigaDOS called Execute(). However,
I am trying to hack the system the hard way rather than do it the correct way!
Since the program is only for one computer that will NEVER be upgraded, this is
not a problem.
If I were to release a program to the public I would just call Execute() in a
way like you suggest rather than use undocumented features (like I am
attempting to do). So don't think that you suggested the wrong way!
Good luck learning C. Just think, you still have C++ to progress to as well!
From SAS/C 6.5 documentation:
" error = system(cmd); " int error; " const char *cmd
" This function invokes the system command processor and passes the 'cmd'
"string to it. Under AmigaDOS, this function invokes the AmigaDOS 'Execute'
"function."
Note also .. if you happened to be working with 2.04+ systems, Commodore
would recommend that you look into the SystemTagList() call in the DOS library.
It's similar to Execute(), but does not read commands from the input
filehandle.
But the original query specified OS 1.2, so SystemTagList() is out .. as it
would be for any project you wanted to work on pre-2.0 Amgigas. The C
function, system(), looks OK for all systems, though.
It may already have been noted in this stream, but just in case: for
Execute() to work on pre-2.0 systems, the RUN command must be present in
logical device C: … now, since the object of this exercise is to reassign C:,
I would *assume* that the old assignment contains RUN so that the switch would
take place properly. Similarly, if the program ever wanted to switch back, the
new assignment should also contain a copy of RUN, too.
–Jim