?
Solved

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

Posted on 2016-09-27
11
Medium Priority
?
87 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +2
11 Comments
 
LVL 40

Assisted Solution

by:evilrix
evilrix earned 664 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 70

Assisted Solution

by:Qlemo
Qlemo earned 332 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 28

Assisted Solution

by:Dr. Klahn
Dr. Klahn earned 332 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 40

Assisted Solution

by:evilrix
evilrix earned 664 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
 
LVL 84

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 672 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 84

Accepted Solution

by:
Dave Baldwin earned 672 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

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.
Suggested Courses

765 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