[comp.sys.amiga.programmer] Another try. What's wrong with this open?

marko@sinanju.UUCP (Mark Moore) (01/13/91)

Forgot to change some things when I pulled the example out of
my application. Sorry.

Why won't this Open work.  MODE_OLDFILE works, but then WaitForChar
doesn't work with the resulting FileHandle.

Please send mail.  I don't get these groups on my home machine.

------------------------------------------------------------------------------

#include <libraries/dos.h>
#include <libraries/dosextens.h>

extern struct FileHandle *Open();

main()
{

  struct FileHandle *fd;

  if (fd = Open("SER:", MODE_READWRITE))
    Close(fd);
  else
    printf("Failed! As usual.\n  ");

}

-------------------------------------------------------------------------------
| Mark Moore                           | "Well, what about Captain Zero?"     |
| marko@sinanju.uucp                   | -Sam Donaldson on the David Brinkley |
| ..!harvard!m2c!jjmhome!sinanju!marko |  show discussing terrorism.          |
-------------------------------------------------------------------------------

andy@cbmvax.commodore.com (Andy Finkel) (01/13/91)

In article <marko.2568@sinanju.UUCP> marko@sinanju.UUCP (Mark Moore) writes:
>Forgot to change some things when I pulled the example out of
>my application. Sorry.
>
>Why won't this Open work.  MODE_OLDFILE works, but then WaitForChar
>doesn't work with the resulting FileHandle.
>
>Please send mail.  I don't get these groups on my home machine.
>
>------------------------------------------------------------------------------
>
>#include <libraries/dos.h>
>#include <libraries/dosextens.h>
>
>extern struct FileHandle *Open();
>
>main()
>{
>
>  struct FileHandle *fd;
>
>  if (fd = Open("SER:", MODE_READWRITE))
>    Close(fd);
>  else
>    printf("Failed! As usual.\n  ");
>
>}


IF you're doing single character I/O you need to use the AUX: handler,
rather than the SER: handler.  AUX: supports WaitForChar().

You may have to mount it before using, depending on your startup-sequence.

>| Mark Moore                           | "Well, what about Captain Zero?"     |

			andy
-- 
andy finkel		{uunet|rutgers|amiga}!cbmvax!andy
Commodore-Amiga, Inc.

"God was able to create the world in only seven days because there
 was no installed base to consider."

Any expressed opinions are mine; but feel free to share.
I disclaim all responsibilities, all shapes, all sizes, all colors.