CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2002
    Posts
    2

    need conversion code form dos to C++

    hi everyone. I have a code in dos which is running perfectly. when i tried the same in C++ i am not getting the correct result.
    i am giving my dos code here if any one can help in converting this from DOS to C++ i am very thankful

    I am attching a zip file in which the DOS C file and related files are there.
    Attached Files Attached Files

  2. #2
    Join Date
    Jun 2002
    Location
    Maastricht / The Netherlands
    Posts
    79
    Haya,

    I had a quick view and I was wondering... are you trying to port a program that is accessing hardware to windows nt/2000/xp, because then you have to use the api to acces the hardware.

    grtnx,

    Sjeng
    The search feature of this forum is on the top right of the page. It might be a very good idea to use it.
    ----------------
    To retain respect for sausages and laws, one must not watch them in the making.
    - Otto von Bismarck (1815-1898) -

  3. #3
    Join Date
    Apr 1999
    Posts
    27,449

    Re: need conversion code form dos to C++

    Originally posted by sam_sun_401
    hi everyone. I have a code in dos which is running perfectly. when i tried the same in C++ i am not getting the correct result.
    i am giving my dos code here if any one can help in converting this from DOS to C++ i am very thankful

    I am attching a zip file in which the DOS C file and related files are there.
    There is no such thing as translating from DOS to C++. DOS is an operating system, C++ is a programming language.

    If what you mean is that you wrote a program in C++ for the DOS operating system and now you want to compile and run the same program for some other operating system, then you are making sense. If this is what you mean, the code that you provided is making direct calls to the hardware. Once you do this, all bets are off as to how another operating system handles these things. For a 32-bit OS, you have to resort to other ways to read or write to hardware. This takes research on your end, since each OS does things differently. For Windows, there is DeviceIOControl, for Linux it is something else.

    But in general, once you start to use BIOS or interrupts (as your program does), it it will more than likely *not* work on another OS, and in all likelihood, crash.

    Regards,

    Paul McKenzie

  4. #4
    Join Date
    Jun 2002
    Location
    Letchworth, UK
    Posts
    1,020
    I wonder how your program actually works. It must be writing all over memory. Anyway the bug:

    GetExactMatrix requires a 2D int array but in ReadDataBuffers, you are passing it a pointer to the 2D array. This is probably what is causing the crash.

    Also the memmoves are specific to 16-bit integers. If it is rebuilt in 32-bits, only half the data will be copied. Might be better if you used sizeof(lo[0]) instead of 500. Then it will work even in 64-bits.

    Anyway, correcting the bits (removal of huge, _far, graph.h and bios.h, adding forward decls) and rebuilding it on 32-bits I get

    error3 -6
    Succinct is verbose for terse

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured