C Questions 
Author Message
 C Questions

I am in need of some help.  Currently the company I work for uses PDS BASIC
for our programs.  We are looking at moving to C, but we still want to keep
the program for DOS.  We are writing another program for Windows in Visual
Basic.  Here are some questions I have:

        1. Is there any easy way to convert any BASIC programs over to C? Also are
there built in functions for creating pop-up boxes and windows in DOS?

        2. How easy would it be to convert a C program for DOS into a C or C++
program for Windows?

        3. Is there a version of C++ for DOS?

Any help would be greatly appreciated.  Thank you for your help.

        - Ryan Peters




Thu, 06 Jan 2000 03:00:00 GMT  
 C Questions

Quote:

>I am in need of some help.  Currently the company I work for uses PDS BASIC
>for our programs.  We are looking at moving to C, but we still want to keep
>the program for DOS.  We are writing another program for Windows in Visual
>Basic.  Here are some questions I have:
>    1. Is there any easy way to convert any BASIC programs over to C? Also are
>there built in functions for creating pop-up boxes and windows in DOS?

There was a BASTOC program that converted GFA-BASIC to C, and it
did work (more or less) on a PC. The vendor _was_ working on a
Windows version. However, reimplementing the stuff in C might be
a wiser way to take, because otherwise you will end up with
a lot of hard to maintain stuff that depends on the use of
special libraries.

Quote:
>there built in functions for creating pop-up boxes and windows in DOS?

Pop-up boxes and windows in DOS are better discussed in a DOS
specific programming newsgroup. The C programming language
certainly does not have such built-in functions.

Quote:
>    2. How easy would it be to convert a C program for DOS into a C or C++
>program for Windows?

This qestion might be better discussed in a Windows programming
specific newsgroup.

Quote:
>    3. Is there a version of C++ for DOS?

Yes, but why do you ask this in comp.lang.c? The most logical forum
for that question is a DOS programming specific newsgroup, imho.

Kurt

--
| Kurt Watzka                             Phone : +49-89-2180-6254



Thu, 06 Jan 2000 03:00:00 GMT  
 C Questions

Quote:

> I am in need of some help.  Currently the company I work for uses PDS BASIC
> for our programs.  We are looking at moving to C, but we still want to keep
> the program for DOS.  We are writing another program for Windows in Visual
> Basic.  Here are some questions I have:

>         1. Is there any easy way to convert any BASIC programs over to C?

No.

Quote:
> Also are
> there built in functions for creating pop-up boxes and windows in DOS?

There are no such functions built into standard ANSI-C.  However, there
are plenty of function libraries (from third parties) which facilitate
windowing in a DOS environment.  Finding the right ones may be a chore.

Quote:

>         2. How easy would it be to convert a C program for DOS into a C or C++
> program for Windows?

Depends on how cleanly the original DOS version was written.  Also, some of
the current Windows compilers have a "console mode" which supports simple
text input and output to a text window.  While perfectly functional, it
isn't really the typical interface found in most windows programs.

Quote:

>         3. Is there a version of C++ for DOS?

Yes.  Turbo C++ for DOS, by Borland.  Also, Both Borland and Microsoft
have older versions of their "professional level" compilers which can
target DOS platforms, though development is usually done in a Windows
environment.
Quote:

> Any help would be greatly appreciated.  Thank you for your help.

>         - Ryan Peters





Thu, 06 Jan 2000 03:00:00 GMT  
 C Questions

Quote:


> > I am in need of some help.  Currently the company I work for uses PDS BASIC
> > for our programs.  We are looking at moving to C, but we still want to keep
> > the program for DOS.  We are writing another program for Windows in Visual
> > Basic.  Here are some questions I have:
> >         1. Is there any easy way to convert any BASIC programs over to C?
> No.

Unless you have the program BAStoC.exe.  This will translate the
majority of yor BASIC program, and though you will have a lot of
'debugging' to do it is easier than rewriting your progam from scratch.

Quote:
> > Also are there built in functions for creating pop-up boxes and windows in DOS?
> There are no such functions built into standard ANSI-C.  However, there
> are plenty of function libraries (from third parties) which facilitate
> windowing in a DOS environment.  Finding the right ones may be a chore.

A good shareware program is called The Window Boss, you can download it
off the `Net.

Quote:
> >         2. How easy would it be to convert a C program for DOS into a C or C++
> > program for Windows?
> Depends on how cleanly the original DOS version was written.  Also, some of
> the current Windows compilers have a "console mode" which supports simple
> text input and output to a text window.  While perfectly functional, it
> isn't really the typical interface found in most windows programs.

I would recommend rewriting the program.  DOS programs that are merely
'adapted' to Windows tend to be very unprofessional looking, better to
just let them run in a DOS box under Windows.

Quote:
> >         3. Is there a version of C++ for DOS?
> Yes.  Turbo C++ for DOS, by Borland.  Also, Both Borland and Microsoft
> have older versions of their "professional level" compilers which can
> target DOS platforms, though development is usually done in a Windows
> environment.

Let us not forget to mention the DJGPP port of GCC which includes a C++
for DOS as well as a C for DOS.

        http://www.delorie.com

--
********************************************

********************************************
I've never had a humble opinion in my life.
If you're going to have one,
why bother to be humble about it?
                                Joan Baez



Fri, 07 Jan 2000 03:00:00 GMT  
 C Questions

Quote:
>I am in need of some help.  Currently the company I work for uses PDS BASIC
>for our programs.  We are looking at moving to C, but we still want to keep
>the program for DOS.  We are writing another program for Windows in Visual
>Basic.  Here are some questions I have:

>        1. Is there any easy way to convert any BASIC programs over to C?

Not an easy way. hand-coding will probably be needed. There may be a translator
or cross-compiler, but I do not know.

Microsoft makes a verison of Visual Basic for DOS.

Quote:
>Also are there built in functions for creating pop-up boxes and windows in

DOS?

DOS-based 'C' compilers include some primitives for doing what you want, but
you'll be repsonsible for the window management and placement. The primitive
windowing functions are not portable between compiler mfrs, though. So once
you've locked into a compiler mfr, you've locked in.

Quote:

>        2. How easy would it be to convert a C program for DOS into a C or C++
>program for Windows?

This is difficult because of the model that Windows uses for the usr interface
is different than the one you use for DOS-based programs. In DOS, you manage
all the windowing, allocation of memory, window hierarchy, etc. In Windows,
Windows manages all that stuff and the interface between the user and the
system is totally different.

Quote:

>        3. Is there a version of C++ for DOS?

>Any help would be greatly appreciated.  Thank you for your help.

Borland makes Turbo C/C++ for DOS and Windows. I beleive Borland C/C++ still
compiles to DOS, too.

Quote:

>        - Ryan Peters



Good luck,
Greg DiGiorgio


Fri, 07 Jan 2000 03:00:00 GMT  
 C Questions

#  

#
# > > I am in need of some help.  Currently the company I work for uses PDS BASIC
# > > for our programs.  We are looking at moving to C, but we still want to keep
# > > the program for DOS.  We are writing another program for Windows in Visual
# > > Basic.  Here are some questions I have:
#
# > >         1. Is there any easy way to convert any BASIC programs over to C?
#  
# > No.

Correct.

# Unless you have the program BAStoC.exe.

Alicia, the question contained the words "any BASIC program".
The answer is just a plain and simple "NO".

# This will translate the
# majority of yor BASIC program, and though you will have a lot of
# 'debugging' to do it is easier than rewriting your progam from scratch.

Is it? I remember the old days with my Sinclair ZX Spectrum.
Had the best built-in BASIC I've ever seen. But it was too slow.
Finally there was a BASIC compiler. You could't imagine how
disappointed I was when I figured it would only compile a
subset of BASIC (even the same lanaguage!). Translating from
language X to language Y is a daunting task that until today
only works for HLL to LLL (like C to asm) but not from HLL to
HLL, IMHO (maybe with a few exceptions, but BASIC -> C is not
one of them).

Points to ponder:

If the to-be-converted program is less than 1000 lines:

  Wouldn't it be easier to write that little thing from
  scratch? Shouldn't take too much time. For someone
  familiar with the target language this is no problem.
  For someone *not* familiar with the target language --
  how is that someone supposed to be able to debug all
  the rest into existence?

If the to-be-converted program is 1000 lines or more:

  Wouldn't it be easier to write that big thing from
  scratch? Should take the same time than debugging
  an elephantine blurb of language translator output
  into existence. Apart from that, what would a programmer
  consider more boring? Debugging ten thousand lines of
  code written by some jerk and converted to twice as
  many lines by an ignorant translator? Or programming
  from scratch? What would you prefer? See!

If I could get at those tapes with my Spectrum BASIC
programs I would send you one and let your BAStoC.exe
chew on one...BTW what does it convert this line to:

        42 PRINT #2;CHR$(42);CHR$(7);"hello, world"
        43 PAUSE 0

(which is supposed to print the familiar greeting in
bright white on the lower two lines of the display and
wait for a keystroke.)

Rule of thumb:

*Never* use X to C translators. They're all dumb, maybe even
cfront :-). Analyze the program and rewrite from scratch.

Regards,

        Jens
--
Jens Schweikhardt  http://www.uni-stuttgart.de/People/schweikhardt/home.html
SIGSIG -- signature too long (core dumped)



Fri, 07 Jan 2000 03:00:00 GMT  
 C Questions

Quote:

>         2. How easy would it be to convert a C program for DOS into a C or C++
> program for Windows?

You asked two other questions, but I don't know anything about them so I
won't pretend to answer them.  As for this one, the answer is: damned
hard.  If you just want a DOS program running in a window in Windows,
all you need to do is run the program from windows instead of from the
DOS command line.  However, I'm guessing that you want to convert the
program to a Windows interface and make it look like all those other
neato windows progs.  

Let's put it this way...there is an 1100 page book by Charles Petzold
that takes you from square 1 in creating a Windows application and you
will need to read every word before you can create a program with a
windows interface.  I've been going at this book for about three weeks
now and I am on page 389.  It's tough reading, but you learn a LOT.  The
conversion of the program will not be changing a few lines of code here
and there.  A windows program is so different that it does not have a
"main" function as you would find in a console program.  You will have
to reduce the program down to its basic algorithms and then reimplement
them in the Windows API.

Good luck.

Jay



Fri, 07 Jan 2000 03:00:00 GMT  
 C Questions

Quote:

> >I am in need of some help.  Currently the company I work for uses PDS BASIC
> >for our programs.  We are looking at moving to C, but we still want to keep
> >the program for DOS.  We are writing another program for Windows in Visual
> >Basic.  Here are some questions I have:
> >        1. Is there any easy way to convert any BASIC programs over to C?
> Not an easy way. hand-coding will probably be needed. There may be a translator
> or cross-compiler, but I do not know.
> Microsoft makes a verison of Visual BASIC for DOS.

Forget that, there is no compatibility.

Quote:
> >Also are there built in functions for creating pop-up boxes and windows in
> DOS?
> DOS-based 'C' compilers include some primitives for doing what you want, but
> you'll be repsonsible for the window management and placement. The primitive
> windowing functions are not portable between compiler mfrs, though. So once
> you've locked into a compiler mfr, you've locked in.

Not really, one of the really neat things about C is; if you keep the
extensions to an absolute minimum and stick to ANSI C as much as
possible, you will be able to switch compilers with very little
difficulty.  Unlike trying to go from PDS BASIC to MS Visual Basic which
will, basically, require a rewrite.

Quote:
> >        2. How easy would it be to convert a C program for DOS into a C or C++
> >program for Windows?
> This is difficult because of the model that Windows uses for the usr interface
> is different than the one you use for DOS-based programs. In DOS, you manage
> all the windowing, allocation of memory, window hierarchy, etc. In Windows,
> Windows manages all that stuff and the interface between the user and the
> system is totally different.

In other words you will have to rewrite the interface and write a
Winmain() function to call the original main() function.

Quote:
> >        3. Is there a version of C++ for DOS?
> >Any help would be greatly appreciated.  Thank you for your help.
> Borland makes Turbo C/C++ for DOS and Windows. I beleive Borland C/C++ still
> compiles to DOS, too.

The DJGPP port of GCC at:
        http://www.delorie.com
offers a 32 bit version of C++ for DOS.  It has it's own extender.

--
********************************************

********************************************
I've never had a humble opinion in my life.
If you're going to have one,
why bother to be humble about it?
                                Joan Baez



Fri, 07 Jan 2000 03:00:00 GMT  
 C Questions

Quote:

> I am in need of some help.  Currently the company I work for uses PDS BASIC
> for our programs.  We are looking at moving to C, but we still want to keep
> the program for DOS.  We are writing another program for Windows in Visual
> Basic.  Here are some questions I have:

Hi Ryan Peters,

Quote:
>         1. Is there any easy way to convert any BASIC programs over to C?

The key word here is "any" and the answer is definitely NO. Basic has
become one of the most widely used "roll-your-own" languages. There are
so many abstract Basic dialects that is is impossible to convert any
Basic
source code to C. The common Basic functionality is in most cases only
used
as the starting point for building a script language around it.

Quote:
> Also are
> there built in functions for creating pop-up boxes and windows in DOS?

No, Visual-Basic is Windows only. But to talk about Basic, you should
select one of the Basic newsgroups, like:
  comp.lang.basic.visual.3rdparty
  comp.lang.basic.visual.announce
  comp.lang.basic.visual.database
  comp.lang.basic.visual.misc
  microsoft.public.vb.*  (some 20 Visual-Basic newsgroups)

Quote:

>         2. How easy would it be to convert a C program for DOS into a C or C++
> program for Windows?

That depends highly on what the program does. And I don't know if there
are any automatic converters. Ask about it in either a Visual-Basic
newsgroup or maybe in the windows programming newsgroup:

Quote:
>         3. Is there a version of C++ for DOS?

Yes there are several. The older Visual-C compilers can compile for
DOS and several Borland-C versions can do so as well. Also there is
Symantec-C and Zortech-C. Relevant newsgroups for C++ for DOS are:


But please keep in mind that DOS is not Windows. All the extra
functionality of Windows is *NOT* available with DOS.

Stephan
(initiator of the campaign against grumpiness in c.l.c)



Fri, 07 Jan 2000 03:00:00 GMT  
 C Questions

Quote:


> >         2. How easy would it be to convert a C program for DOS into a C or C++
> > program for Windows?

> Let's put it this way...there is an 1100 page book by Charles Petzold
> that takes you from square 1 in creating a Windows application and you
> will need to read every word before you can create a program with a
> windows interface.

        Say what?  I've not read close to that entire book and have written
a handful of fully functioning Windows apps.  I'd recommend reading the
first
few chapters to get an understanding of the basics (event-handling,
message
loops, etc.), and then use the rest as reference as you need it.  Also,
if
you're using an advanced tool like Visual C++ or Visual Basic, which you
should
be, constructing the GUI is the easy part...

--
Dave M.



Sun, 09 Jan 2000 03:00:00 GMT  
 C Questions

Quote:


> >         2. How easy would it be to convert a C program for DOS into a C or C++
> > program for Windows?

> Let's put it this way...there is an 1100 page book by Charles Petzold
> that takes you from square 1 in creating a Windows application and you
> will need to read every word before you can create a program with a
> windows interface.

        Say what?  I've not read close to that entire book and have written
a handful of fully functioning Windows apps.  I'd recommend reading the
first
few chapters to get an understanding of the basics (event-handling,
message
loops, etc.), and then use the rest as reference as you need it.  Also,
if
you're using an advanced tool like Visual C++ or Visual Basic, which you
should
be, constructing the GUI is the easy part...

--
Dave M.



Sun, 09 Jan 2000 03:00:00 GMT  
 C Questions

Quote:


> >         2. How easy would it be to convert a C program for DOS into a C or C++
> > program for Windows?
> Let's put it this way...there is an 1100 page book by Charles Petzold
> that takes you from square 1 in creating a Windows application and you
> will need to read every word before you can create a program with a
> windows interface.        

Say what?  I've not read close to that entire book and have written
a handful of fully functioning Windows apps.  I'd recommend reading the
first
few chapters to get an understanding of the basics (event-handling,
message
loops, etc.), and then use the rest as reference as you need it.  Also,
if
you're using an advanced tool like Visual C++ or Visual Basic, which you
should
be, constructing the GUI is the easy part...

--
Dave M.



Sun, 09 Jan 2000 03:00:00 GMT  
 C Questions


Quote:


>> >I am in need of some help.  Currently the company I work for uses
PDS BASIC
>> >for our programs.  We are looking at moving to C, but we still want
to keep
>> >the program for DOS.  We are writing another program for Windows in
Visual
>> >Basic.  Here are some questions I have:

>> >        1. Is there any easy way to convert any BASIC programs over
to C?

>> Not an easy way. hand-coding will probably be needed. There may be a
translator
>> or cross-compiler, but I do not know.

>> Microsoft makes a verison of Visual BASIC for DOS.

>Forget that, there is no compatibility.

Compatiblity to what?

- Show quoted text -

Quote:

>> >Also are there built in functions for creating pop-up boxes and
windows in
>> DOS?

>> DOS-based 'C' compilers include some primitives for doing what you
want, but
>> you'll be repsonsible for the window management and placement. The
primitive
>> windowing functions are not portable between compiler mfrs, though.
So once
>> you've locked into a compiler mfr, you've locked in.

>Not really, one of the really neat things about C is; if you keep the
>extensions to an absolute minimum and stick to ANSI C as much as
>possible, you will be able to switch compilers with very little
>difficulty.  

This guy is not talking about switching compilers, but languages! - a
slight difference. And, yes, if you rely on windowing functions in any
DOS compiler, you will *not* be portable, as I said above. Once you've
locked in, you've locked (unless you want to go thru another rewrite).

What you suggest, I think, is coding all the windowing functions
(allocation, deallocation, placement, overlapping, popup, etc) yourself
using standard ANSI C. This is doable, but not for the typical
application programmer.

Doing this stuff yourself for a single application system is akin to
buying a boat, sailing into the ocean, and harpooning a whale so you
can see what one looks like. Yeah, you can do it, but why would you
want to.

- Show quoted text -

Quote:
>Unlike trying to go from PDS BASIC to MS Visual Basic which
>will, basically, require a rewrite.

>> >        2. How easy would it be to convert a C program for DOS into
a C or C++
>> >program for Windows?

>> This is difficult because of the model that Windows uses for the usr
interface
>> is different than the one you use for DOS-based programs. In DOS,
you manage
>> all the windowing, allocation of memory, window hierarchy, etc. In
Windows,
>> Windows manages all that stuff and the interface between the user
and the
>> system is totally different.

>In other words you will have to rewrite the interface and write a
>Winmain() function to call the original main() function.

You minimize the user interface stuff. In a professional level DOS
program, user interface code can account for up to 80%+ of an
application. Why do you think Windows needs 16M to run? Why do you
think Windows programming language environments suck up 200M of disk
space?

- Show quoted text -

Quote:

>> >        3. Is there a version of C++ for DOS?

>> >Any help would be greatly appreciated.  Thank you for your help.

>> Borland makes Turbo C/C++ for DOS and Windows. I beleive Borland
C/C++ still
>> compiles to DOS, too.

>The DJGPP port of GCC at:
>        http://www.delorie.com
>offers a 32 bit version of C++ for DOS.  It has it's own extender.

>--
>********************************************

>********************************************
>I've never had a humble opinion in my life.
>If you're going to have one,
>why bother to be humble about it?
>                                Joan Baez

You should be more humble.

Greg



Sun, 09 Jan 2000 03:00:00 GMT  
 C Questions

Quote:


> >> Microsoft makes a verison of Visual BASIC for DOS.

> >Forget that, there is no compatibility.

> Compatiblity to what?

Presumably VB-Win

Quote:
> What you suggest, I think, is coding all the windowing functions
> (allocation, deallocation, placement, overlapping, popup, etc) yourself
> using standard ANSI C. This is doable, but not for the typical
> application programmer.

I think the suggestion is rather more that if you keep the
non-portable sections of code seperate from your main code then when
you port to a new environment all you need to rewrite is the
non-portable stuff. Everything else should stay the same. This also
facilitates maintaining versions for multiple environments
simultaneously.

--

            http://www.geocities.com/SiliconValley/Lakes/7537/
Supporter of the campaign against grumpiness in c.l.c



Sun, 09 Jan 2000 03:00:00 GMT  
 C Questions

Quote:



> > >> Microsoft makes a verison of Visual BASIC for DOS.

> > >Forget that, there is no compatibility.

> > Compatiblity to what?

> Presumably VB-Win

> > What you suggest, I think, is coding all the windowing functions
> > (allocation, deallocation, placement, overlapping, popup, etc) yourself
> > using standard ANSI C. This is doable, but not for the typical
> > application programmer.

> I think the suggestion is rather more that if you keep the
> non-portable sections of code seperate from your main code then when
> you port to a new environment all you need to rewrite is the
> non-portable stuff. Everything else should stay the same. This also
> facilitates maintaining versions for multiple environments
> simultaneously.

AHa!!! A spark of intelligence.  Please continue, I try hard to nurture
intelligence and thinking.

Actually, I use VB (for Windows) or X (for Unix) to do the interface,
writing the bulk of the program in portable C, then (for Windows)
compiling to a .dll.  My C code is portable, if I want to move to Unix,
all I need do is write an interface, using curses or X-Windows, which
can call the meat and potatoes from a loadable library (or a linked
one).

It would be easier if Microsoft supported X under Windows.

--
********************************************

********************************************
It used to be:
Spare the rod and spoil the child.

Today it's:
Spare the rod to stay out of jail.



Mon, 10 Jan 2000 03:00:00 GMT  
 
 [ 15 post ] 

 Relevant Pages 

1. Request texts / references on C 'internals' (novice CS questions)

2. Newbie: separate big .cs file into small .cs files

3. How to show/call Form2.cs from Form1.cs ?

4. Include code in other Cs files

5. Reuse of cs files, namespace, arch advice pls

6. word - automatic numbering/bold/underline/italics

7. How to Generate .cs file at Runtime

8. newbe/cs student, need help w/ code

9. Serial.cs

10. Compile CS source code using ICodeCompiler

11. Two CS files (using namespaces)

12. My .cs files were deleted!?

 

 
Powered by phpBB® Forum Software