Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

DOSin about

Hadji_13Hadji_13 Member Posts: 274
Hi

I need to work with dos and QB at the same time and I'm not sure how.

I'm running a program for QB using a shell command. I want to then pick up the errorlevel and use it in my program.
Does anyone know how to do it? Would it be easist to pipe the errorlevel into a file and retreave it from there?

Ta

Hadji
----------------------------------------------------
The solution to the problem changes the problem

Comments

  • PrzemekG_PrzemekG_ Member Posts: 595
    I'm sure in QB45(only in qb45) there is a hiden function to retrive and send the error level. It is not documented so you have to search for it on other qbasic messege boards and turorials or you can also ask in assembler programming how to retrieve the error level. You can use an utility like unlib and unlib all qbasic libraries (I thing qb.lib) and search for a strainge module and disasemble it to see what arguments you need to pass.

    I know that qbasic has a function like that from a small help program (writen in qbasic). I had many examples of qb code (like svga libraries, how use long filenames in qb and other)

  • PrzemekG_PrzemekG_ Member Posts: 595
    Ok, to get the errorlevel you must use an interrupt
    [code]
    function GetErrorLevel%()
    dim reg as RegType
    dim temp%, offs%
    reg.ax = &h4d00h
    interrupt &h21, reg,reg
    temp% = reg.cx
    def seg = varseg(temp%)
    GetErrorLevel=peek(varptr(temp%)+1)
    def seg
    end function
    [/code]

    Try it and tell me if it works or not

    If this function is called it reset the error level to 0 so store it in variable
  • Chris BrownChris Brown USAMember Posts: 4,624 ✭✭

    ____ // http://forcoder.org // free video tutorials and ebooks about // Visual Basic, Visual Basic .NET, C, JavaScript, C++, Delphi, Ruby, Scratch, Java, R, C#, PL/SQL, Python, Perl, Assembly, Go, Swift, MATLAB, PHP, Objective-C LabVIEW, Scala, Dart, ML, Clojure, SAS, Kotlin, VBScript, FoxPro, D, COBOL, Alice, Apex, Logo, Erlang, Awk, Lisp, Ada, Hack, F#, Crystal, Fortran, Transact-SQL, Rust, Julia, Bash, Scheme, Lua, ABAP, Prolog // ________

Sign In or Register to comment.