Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2016-09-27
11
Medium Priority
?
95 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 71

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 29

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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

INTRODUCTION The purpose of this document is to demonstrate the Installation and configuration of the Data Protection Manager product. Note that this demonstration was prepared on the basis of Windows OS is 2008 R2 and DPM 2010. DATA PROTECTI…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
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…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

610 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