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

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
TMarkBAsked:
Who is Participating?
 
Dave BaldwinConnect With a Mentor Fixer of ProblemsCommented:
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
 
evilrixConnect With a Mentor Senior Software Engineer (Avast)Commented:
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
 
QlemoConnect With a Mentor Batchelor, Developer and EE Topic AdvisorCommented:
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
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

 
Dr. KlahnConnect With a Mentor Principal Software EngineerCommented:
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
 
evilrixConnect With a Mentor Senior Software Engineer (Avast)Commented:
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
 
Dave BaldwinConnect With a Mentor Fixer of ProblemsCommented:
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
 
TMarkBAuthor Commented:
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
 
evilrixSenior Software Engineer (Avast)Commented:
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
 
TMarkBAuthor Commented:
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.