Announcement

Collapse
No announcement yet.

SHELL executable program asynchronously

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • SHELL executable program asynchronously

    Just how does this happen?

    My current code has an Error 51. !!!

    INFO:

    PB/CC IDE INFO:
    VERSION 4.00.0038

    up-graded to PBCC 4.04


    SHELL ("C:\CMD.EXE" + ("TYPE") + " G:\TEMP41 >> F:\TEMP42.TXT",1)


    51 Internal error

    If you are unable to identify the cause of the problem,
    contact the PowerBASIC Technical Support group with
    information about your program.

    XP PRO SP3

    CMD.EXE INFO:

    Microsoft Windows XP [Version 5.1.2600]
    (C) Copyright 1985-2001 Microsoft Corp.

    Anyone see an easy error?

    Harold
    WORDS to NUMBERS and AI,
    UAV's is my interest.

  • #2
    Code:
    SHELL ("C:\CMD.EXE" + ("TYPE") + " G:\TEMP41 >> F:\TEMP42.TXT",1)
    I don't think that should have compiled, because '("TYPE")' (with the parens) does not make any sense at all.

    I think what you were trying to do was ...

    SHELL ("C:\CMD.EXE TYPE G:\TEMP41 >> F:\TEMP42.TXT",1)

    ..which is also incorrect, but I'll let you worry about that once it starts running.

    But to figure out our error 51 you COULD ...

    If you are unable to identify the cause of the problem,
    contact the PowerBASIC Technical Support group with
    information about your program.
    Send to [email protected]

    (This board is not an official means of communication with PowerBASIC Inc. )

    MCM
    Michael Mattias
    Tal Systems (retired)
    Port Washington WI USA
    [email protected]
    http://www.talsystems.com

    Comment


    • #3
      I see a few possible problems here. You have a missing space between CMD.EXE and TYPE. Is CMD.EXE really at c:\ on your system, it is at c:\windows\system32 on my XP system. You can use ENVIRON$("COMSPEC") to look up the path to cmd.exe or maybe you are using a custom version of cmd.exe. Your call the cmd.exe should include the /c switch to tell it to carry out the command then terminate. Try putting the shell string in a variable and either print the variable or watch it in the debugger and make sure that is formatted correctly.

      Code:
      #COMPILE EXE
      #DIM ALL
      FUNCTION PBMAIN () AS LONG
        LOCAL strShell AS STRING
        strShell = ENVIRON$("COMSPEC") + " /C G:\TEMP41 >> F:\TEMP42.TXT"
        ? strShell
        SHELL (strShell, 1)
        ? ERR
        WAITKEY$
      END FUNCTION
      Sincerely,

      Steve Rossell
      PowerBASIC Staff

      Comment


      • #4
        Better.......
        Code:
        FUNCTION PbMain ()AS LONG
        
         strShell = ENVIRON$("COMSPEC") + " /C TYPE G:\TEMP41 >> F:\TEMP42.TXT"
         Y = SHELL (strShell)
        Better still....

        Code:
        FUNCTION AppendFile (sourceFile AS STRING, destfile AS STRING) AS LONG
        
         LOCAL hFile AS LONG, s AS STRING
        
          hFile = FREEFILE
          OPEN    sourceFile FOR BINARY AS hFile 
          GET$    hFile, LOF(hFile), S 
          CLOSE   hFile
          hFile = FREEFILE
          OPEN    destfile FOR APPEND as hFile
          PUT$    hFile, S 
          CLOSE   hFile
        
        END FUNCTION 
        
        FUNCTION PBMAIN() AS LONG
        
           CALL AppendFile ("G:\TEMP41", "F:\TEMP32.txt") 
        
        END FUNCTION
        MCM
        Michael Mattias
        Tal Systems (retired)
        Port Washington WI USA
        [email protected]
        http://www.talsystems.com

        Comment


        • #5
          hi Harold,

          I am glad you posted that.
          thanks Steve and Michael


          If you wanted to write a program to be used as a script handler, you would need that to work correctly.

          paul
          p purvis

          Comment


          • #6
            Large Arrays The Time Is Now!!!

            My thanks goes to "YOU ALL", but


            LARGE ARRAYS THE TIME IS NOW!!!

            First you start with two Pinnacle systems, then
            you load "Fedora linux" (.org) as a host OS and
            run windows as a virtual machine, and a few other
            OS like Windows XP Pro SP3, DOS and more.

            Most of your "Vmware" uses computers with some
            horse-power. Other than the "ram-drives" most
            of the system components are within reach
            of small-business. You heard it first hear.

            "THE NEXT GENERATION OF COMPUTERS ARE NOT FOR
            PEOPLE BUT MACHINES, WHICH WILL REQUIRE A
            DIFFERENT MIND-SET, AND A NEW O/S WHICH
            CAN HANDLE 80,000 FILES PER SECOND OF
            2-MEG". The "TERA" thumb-drive is coming,
            ref. Nano-Tech Arizona State University,
            Michael Kozicki.

            SO THE QUESTION OF LARGE ARRAYS IS IMPORTANT,
            SO IS "INSTR(" BEYOND 64 BYTES, DO SOME
            TIME TESTING ON YOUR STRINGS.


            Pinnacle 4A8001H - 4U quad Opteron (Model 8350).
            with 8 hotswap drives (4 TERA BYTES).

            URL:

            Fedora linux (.org)

            VirtualBox.org

            Google "RamSan-400"

            Or for the real money use:

            The "StorageSPIRE SSD" array is a direct
            replacement for high end rotatiting RAID
            arrays or an alternative to in-server-memory
            systems...

            Highlights:

            * 500GB to 1TB Array of Solid State Disk.

            * Reduces total cost of transaction intensive
            applications.

            * PermaRACK™ allows for modular replacement
            of 100% of all active components without
            de-racking or tools.

            * Supports Fibre Channel configurations for
            servers, clusters and SANs.

            * RMR - Remote Management Software.

            Other Work Stations include:

            SuperMicro's H8QMi-2+, or X7QC3 as support I/O.

            and

            "Pinnacle / Horizon 5O804"

            Primary use SMP server for the scientific
            and enterprise communities. Form factor
            5U rackmount or full-tower chassis.

            Processors = 8x Single or dual core AMD
            "SledgeHammer" Opterons 800 series to (16ea.).

            Processors Cache = 1MB L2 cache per core
            NVIDIA nForce 2200 and AMD 8131 to (16ea.).

            Memory = 32x 400MHz EC DDR (128GB max).

            Expansion = 1x PCI-e 16x, 1x PCI-e 4x,
            1x PCI-X 133MHz, 2x PCI-X 100MHz.

            Network = 2x Gigabit Ethernet.

            Drive Controllers = Integrated 4 port NVIDIA
            SATA controller.

            Drive bays = 4x Hotswap SATA, 3x 5.25", 1x 3.5".

            Video = Onboard 8MB SVGA with Optional IPMI.

            Power supply = Redundant 1350W.

            Dimensions (WxLxH) = 16.7" x 26.8" x 8.7"

            Weight (lbs) = 90 lbs.

            Starting at = $15,000.00.


            Don't forget existing technology like:

            "XJ 2000 SAS/SATA JBOD Series"


            and others "LIKE":

            Ultra-Density 4U 48-drive SAS/SATA JBOD boxes.
            Each has "XJ-SA24-448R" is designed to provide
            a ultra-density 48-drive enclosure in a 4U
            form factor and at per/drive price points
            substantially better than standard single
            density enclosures. It supports up to 24Tbytes
            of storage capacity with 48Gbps host bandwidth
            across dual hot-swappable expander modules.

            Other Laptop 2.5 form factor Solid State Disks:

            "MTRON PRO 3.5 64GB SATA SSD" $ 1,950.00.

            As you can see there is use for large ARRAYS.




            Harold P Boushell
            AI with "Words to Numbers"
            HPB Vector Co WSO
            VER00 REV01 31MAR08
            WORDS to NUMBERS and AI,
            UAV's is my interest.

            Comment


            • #7
              >As you can see there is use for large ARRAYS

              No, what you have shown is that there is (or will soon be) hardware support for large arrays.

              "Use" is a horse of a different color.

              Then again, you can already use PB arrays with more than 2 GB of data, as long as you are willing to work in pieces...

              Memory Mapped Files instead of RANDOM disk file access 5-8-04

              MCM
              Michael Mattias
              Tal Systems (retired)
              Port Washington WI USA
              [email protected]
              http://www.talsystems.com

              Comment

              Working...
              X