Solved

Recompile a DOS C program to MS Visual C++ for Windows 7 (or 10)

Posted on 2016-09-27
11
65 Views
Last Modified: 2016-11-08
Greetings all,

Due to a contract restart, I have to update, compile and run a DOS C program on WIndows 7 computers.  

I have the C code in a text file.  When I have tried running the utility under compatibility mode, I get the following error: "This version of the file is not compatible with the version of Windows you're running.  Check your computer's system information to see whether you need an x86 (32-bit) or x64 (64-bit) version of the program, and then contact the software publisher."

Is there a simple way to copy and paste the C code into Visual C++ 2015 and target the compilation to WIn 7 which acts like DOS?

The DOS utility generates the burn file for PROMs and also the documentation files for the PROMs.

I would imaging that the execution of the utility under Win 7 would simply open a Command Prompt like window which would act like a DOS screen.  There should be no real issue in writing the documentation files as they are simply text files.

Any suggestions greatly appreciated.

Mark
0
Comment
Question by:TMarkB
  • 3
  • 2
  • 2
  • +2
11 Comments
 
LVL 40

Assisted Solution

by:evilrix
evilrix earned 166 total points
ID: 41818600
Well, Visual Studio 2015 (which is free) does allow you to build DOS applications; however, it doesn't support some of the older DOS stuff and may not have all the headers or libraries you need. The best thing is to suck it and see. Just download and install VS2015. Create a new DOS project, copy the code into the project and try building it with default settings. Unfortunately, that really is about the best you can do. If you get build errors let us know what they are. If the source code isn't too large and you don't mind sharing it with us we could have a go and trying to build it for you.
0
 
LVL 68

Assisted Solution

by:Qlemo
Qlemo earned 83 total points
ID: 41818609
The error message probably results from a 16bit DOS program started on a 64bit OS. You can try if it runs on a 32bit W7, that might be the most simple approach.

If there is no hardware access required, you should be able to compile the old code in VS 2015 as a console application. But it might require to fiddle with some options.
0
 
LVL 24

Assisted Solution

by:Dr. Klahn
Dr. Klahn earned 83 total points
ID: 41819215
If this is a one-shot, I'd buy an old laptop with Windows 95 or Windows NT V4.  That's about as close to real DOS as possible without going back to Windows 3.1.  Put an old copy of Borland C or Visual C on it, and use that for the project.  Then when done, zip it up into a case, give it to the customer with your compliments, and say "Don't lose this, it's the only system in the world that can update your PROMs."
0
 
LVL 40

Assisted Solution

by:evilrix
evilrix earned 166 total points
ID: 41819237
The last version of Visual Studio that can build true DOS is 1.52, and finding a legitimate copy of that is like finding hen's teeth, so I don't think that is a realistic option. The problem here isn't the version of Windows, it's the version of the compiler.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 83

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 168 total points
ID: 41820218
MinGW based on the Linux / Unix compilers may be an option for you.  Included are C, C++, and some other compilers.  http://www.mingw.org/
0
 

Author Comment

by:TMarkB
ID: 41820353
Just to clarify, the intention is to take C code and recompile to run on WIN 7 or WIN 10.  Unfortunately, this is not a one time use.  I will be needing to use this a couple more times in the future.
0
 
LVL 40

Expert Comment

by:evilrix
ID: 41821026
Okay, so have you tried using Visual studio 2015 (the community edition is free and can be used to create software for distribution without any licencing concerns) as I suggested?
0
 

Author Comment

by:TMarkB
ID: 41827333
Greetings all... any suggestions on how to proceed greatly welcomed.

The good news was that Visual Studio 15 does allow importing of older C code.

Now for the bad news:

I took a look at the obj file and found out that it was compiled using TC86 Borland Turbo C++ 3.00.

The bad news is that Visual Studio 15 apparently has no clue what to do with the C preprocessor directives.

The following does not seem to have meaning even though I thought these were common across platforms:
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<string.h>
#include<ctype.h>
#include<time.h>

Visual Studio 15 doesn't know where to look to get these.

As a result, when using a line like:
now = time(NULL) ... A error on the NULL appears.

I took a look at trying to create a console program.  VS15 immediately forces you into the C++ CLASS model.  There do not seem to be an option in using simple basic C from days of old.

Any suggestions on how to recompile a C code into Windows 7??

Are there any current era C windows C (not C++) compilers on the market that run under Windows 7?

Thanks
0
 
LVL 83

Accepted Solution

by:
Dave Baldwin earned 168 total points
ID: 41827349
MinGW based on the Linux / Unix compilers may be an option for you.  Included are C, C++, and some other compilers.  http://www.mingw.org/  It's free.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This is a little timesaver I have been using for setting up Microsoft Small Business Server (SBS) in the simplest possible way. It may not be appropriate for every customer. However, when you get a situation where the person who owns the server is i…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now