home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 1409 < prev    next >
Encoding:
Text File  |  1996-08-05  |  2.9 KB  |  120 lines

  1. Path: mail2news.demon.co.uk!cliffe.demon.co.uk
  2. From: Steven Chapman <steve@cliffe.demon.co.uk>
  3. Newsgroups: comp.sys.amiga.programmer
  4. Subject: C
  5. Date: Thu, 18 Jan 96 18:01:21 GMT
  6. Message-ID: <9601181801.AA0003c@cliffe.demon.co.uk>
  7. X-NNTP-Posting-Host: cliffe.demon.co.uk
  8. X-NewsSoftware: GRn 2.1 19/2/94 (PostNews Fix 31/3/95 Martin Hunt)
  9. MIME-Version: 1.0
  10. Content-Type: text/plain; charset=iso-8859-1
  11. Content-Transfer-Encoding: 8bit
  12. X-Mail2News-Path: relay-4.mail.demon.net!post.demon.co.uk!cliffe.demon.co.uk
  13.  
  14.  
  15. I am trying to get this src to compile and work but i need the output
  16. to go to a file in Ram: and not the CON: window that it opens.
  17.  
  18. I now that i have too change the file pointer somehow but a can not fine
  19. out how.
  20.  
  21. Please Help.
  22.  
  23.  
  24. **********************
  25. ToolType  PROG=list C:
  26. **********************
  27.  
  28.  
  29.  
  30.  
  31. #include <stdio.h>
  32. #include <stdlib.h>
  33. #include <string.h>
  34.  
  35. #include <dos/dos.h>
  36. #include <dos/dostags.h>
  37. #include <exec/exec.h>
  38. #include <intuition/intuition.h>
  39. #include <libraries/gadtools.h>
  40. #include <rexx/errors.h>
  41. #include <rexx/rexxio.h>
  42. #include <rexx/rxslib.h>
  43. #include <rexx/storage.h>
  44.  
  45. #include <clib/dos_protos.h>
  46. #include <clib/exec_protos.h>
  47. #include <clib/intuition_protos.h>
  48. #include <clib/gadtools_protos.h>
  49. #include <clib/rexxsyslib_protos.h>
  50. #include <clib/alib_protos.h>
  51.  
  52. #include <workbench/startup.h>
  53. #include <workbench/workbench.h>
  54. #include <workbench/icon.h>
  55. #include <clib/icon_protos.h>
  56.  
  57. #define VERSION 33
  58. #define PRGTEXT "\nProgram: "
  59. #define ICONTEXT "\nIkon: "
  60. #define SHELLTEXT "\nStarta ifrn Workbench!\n"
  61.  
  62. extern struct WBStartup *WBenchMsg;
  63.  
  64. struct Library *IconBase;
  65.  
  66. int main(int argc, char **argv)
  67. {
  68.  struct WBArg      *wbarg;
  69.  struct DiskObject *dobj;
  70.  UBYTE             **tools,*textp;
  71.  BPTR           fh;
  72.  LONG           argnum;
  73.  
  74.  if(!argc) {
  75.     if(!(fh = Open("CON:10/10/400/400/WBtest",MODE_NEWFILE)))
  76.         exit(10);
  77.         IconBase = OpenLibrary((UBYTE *)"icon.library",VERSION);
  78.     if(!IconBase) {
  79.         Close(fh);
  80.         exit(10);
  81.     }
  82.         wbarg = WBenchMsg->sm_ArgList;
  83.     argnum = WBenchMsg->sm_NumArgs;
  84.  
  85.     Write(fh,PRGTEXT,strlen(PRGTEXT));
  86.     Write(fh,wbarg->wa_Name,strlen(wbarg->wa_Name));
  87.  
  88.         dobj = GetDiskObject((UBYTE *)wbarg->wa_Name);
  89.         tools = (UBYTE **)dobj->do_ToolTypes;
  90.         textp = FindToolType(tools,(UBYTE *)"PROG"); 
  91.         Write(fh,textp,strlen(textp));
  92.     printf ("%s",textp);
  93.  
  94.     Execute (textp,fh,0);
  95.     FreeDiskObject(dobj);
  96.  
  97.     for(wbarg++; --argnum; wbarg++) {
  98.         Write(fh,ICONTEXT,strlen(ICONTEXT));
  99.         Write(fh,wbarg->wa_Name,strlen(wbarg->wa_Name));
  100.     }
  101.  
  102.     CloseLibrary(IconBase);
  103.     Delay(200);
  104.     Close(fh);
  105.  }
  106.  else
  107.     Write(Output(),SHELLTEXT,strlen(SHELLTEXT));
  108. }
  109.  
  110.  
  111.  
  112.  
  113. -- 
  114. =========================================================
  115. |  Steven Chapman - steve@cliffe.demon.co.uk (Private ) |
  116. | Amiga 4000/030, Workbench 3.1, Kickstart 3, 1 Gig HD  |
  117. |          4 meg Fast Ram, 2 Meg Chip Ram.              |
  118. =========================================================
  119.  
  120.