471,108 Members | 1,706 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,108 software developers and data experts.

DOS to Windows

I have a program writeen in Microsoft QC 2.5 for DOS which has a very
simple interface of using printf and sscanf also gets and puts. Is there
an easy way to convert this to Window?
Thanks
Stan
Nov 14 '05 #1
22 1841

"Stan Weiss" <sr*****@erols.com> wrote in message
news:41***************@erols.com...
I have a program writeen in Microsoft QC 2.5 for DOS which has a very
simple interface of using printf and sscanf also gets and puts. Is there
an easy way to convert this to Window?


Of topic of course, but you could just run it in a DOS window...

Nov 14 '05 #2
Stan Weiss <sr*****@erols.com> scribbled the following:
I have a program writeen in Microsoft QC 2.5 for DOS which has a very
simple interface of using printf and sscanf also gets and puts. Is there
an easy way to convert this to Window?


Try using the exact same source code. The functions printf, sscanf, gets
and puts are portable across all implementations.
However please note that the function gets is broken as designed. It is
considered impossible to use safely. You may wish to use fgets instead.

--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ------------- Finland --------\
\-------------------------------------------------------- rules! --------/
"To err is human. To really louse things up takes a computer."
- Anon
Nov 14 '05 #3
I do this now under Win 98SE and W2K but I have been told that it will
not run on XP. I do not have XP and was just looking to upgrade it. I
have Visual Studio 6 with SP5 and have only been using VB, so now was
look to move to VC++.
Stan

dandelion wrote:

"Stan Weiss" <sr*****@erols.com> wrote in message
news:41***************@erols.com...
I have a program writeen in Microsoft QC 2.5 for DOS which has a very
simple interface of using printf and sscanf also gets and puts. Is there
an easy way to convert this to Window?


Of topic of course, but you could just run it in a DOS window...

Nov 14 '05 #4

"Stan Weiss" <sr*****@erols.com> wrote in message
news:41***************@erols.com...
I do this now under Win 98SE and W2K but I have been told that it will
not run on XP.
Huh? Why not?

I do not have XP and was just looking to upgrade it. I
have Visual Studio 6 with SP5 and have only been using VB, so now was
look to move to VC++.


From VB that's a good move. Sorry I cannot help you, but my expirience with
Windows (programminG) is not as extensive as the experts of a dedicated
news-group.

I suggest you try there to get expert advice.
Nov 14 '05 #5
In article <41***********************@dreader14.news.xs4all.n l>,
dandelion <da*******@meadow.net> wrote:

"Stan Weiss" <sr*****@erols.com> wrote in message
news:41***************@erols.com...
I do this now under Win 98SE and W2K but I have been told that it will
not run on XP.


Huh? Why not?


It works. Despite what you may have heard, XP does have a "Command Prompt".

In their eternal wisdom, Microsoft keeps trying to scare people into
thinking that the "Command Prompt" (aka, "DOS Window") is going to go away
at some point, and has even managed to convince some people that it *has*
gone away in XP, but such claims are BS.

Note: It *might* be the case that some installations of XP have disabled
the ability to "shell out" (I've heard rumors to this effect - that you can
configure XP this way, but I've never seen an actual instance of it), but
even then, you should be able to run your program (i.e., the CMD.EXE is
still there, but is somehow made inaccessible to the casual user).

(All O/T, of course)

Nov 14 '05 #6
Kenny McCormack <ga*****@yin.interaccess.com> scribbled the following:
It works. Despite what you may have heard, XP does have a "Command Prompt". In their eternal wisdom, Microsoft keeps trying to scare people into
thinking that the "Command Prompt" (aka, "DOS Window") is going to go away
at some point, and has even managed to convince some people that it *has*
gone away in XP, but such claims are BS. Note: It *might* be the case that some installations of XP have disabled
the ability to "shell out" (I've heard rumors to this effect - that you can
configure XP this way, but I've never seen an actual instance of it), but
even then, you should be able to run your program (i.e., the CMD.EXE is
still there, but is somehow made inaccessible to the casual user). (All O/T, of course)


Note that ever since Windows NT, Windows doesn't have an underlying DOS
installation any more. On the contrary, Windows is the underlying
installation, and an *emulation* of DOS runs over it. For ISO standard C
programs, there won't be any difference, but attempts to use
DOS-specific features (such as bitmap graphics) might not work, or might
even crash the computer.

--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ------------- Finland --------\
\-------------------------------------------------------- rules! --------/
"No, Maggie, not Aztec, Olmec! Ol-mec!"
- Lisa Simpson
Nov 14 '05 #7
On 8 Nov 2004 17:47:56 GMT, Joona I Palaste <pa*****@cc.helsinki.fi> wrote:
Kenny McCormack <ga*****@yin.interaccess.com> scribbled the following:
It works. Despite what you may have heard, XP does have a "Command Prompt".
In their eternal wisdom, Microsoft keeps trying to scare people into
thinking that the "Command Prompt" (aka, "DOS Window") is going to go away
at some point, and has even managed to convince some people that it *has*
gone away in XP, but such claims are BS.

Note: It *might* be the case that some installations of XP have disabled
the ability to "shell out" (I've heard rumors to this effect - that you can
configure XP this way, but I've never seen an actual instance of it), but
even then, you should be able to run your program (i.e., the CMD.EXE is
still there, but is somehow made inaccessible to the casual user).

(All O/T, of course)


Note that ever since Windows NT, Windows doesn't have an underlying DOS
installation any more. On the contrary, Windows is the underlying
installation, and an *emulation* of DOS runs over it.


This is generally correct. There are some cases where the emulation is not
correct such as with sound cards, but that's another story.
For ISO standard C
programs, there won't be any difference, but attempts to use
DOS-specific features (such as bitmap graphics) might not work, or might
even crash the computer.


Dos specific features work perfectly under Windows 95 and NT. Windows XP
supports the standard VGA and VESA graphics modes without problem (although
require the program to be run full-screen). The only two things which I
know don't work under Windows would be Soundblaster emulation (and a
3rd-party fixed that), and high-resolution timers used to emulate
high-quality sound on the PC speaker.

The only significant implementation difference between Dos and Windows
would be differences in using malloc() and accessing memory just outside of
the allocated memory. This enters the realm of undefiend behaviour, but is
only important if you wonder why your program only crashes in one of the
two settings.

Nov 14 '05 #8
Raymond Martineau wrote:
[...] This enters the realm of undefiend behaviour, [...]


What a serendipitous spelling error! We have at last
learned what sort of demons inhabit the nasal passages:
they are the undefiends!

--
Er*********@sun.com

Nov 14 '05 #9
On Mon, 08 Nov 2004 09:49:39 -0500, in comp.lang.c , Stan Weiss
<sr*****@erols.com> wrote:
I do this now under Win 98SE and W2K but I have been told that it will
not run on XP.


Then you were almost certainly misinformed - if anything, XP is more
tolerant of 16-bit apps than W2K, and it even has a Win98 compatability
mode to help you further (I run several of my kids' games in this mode,
works a treat).

But this is offtopic here, and you will get authorative answers in one of
the MS groups so please ask there.
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt>

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Nov 14 '05 #10
On Mon, 08 Nov 2004 17:38:29 GMT, in comp.lang.c ,
ga*****@yin.interaccess.com (Kenny McCormack) wrote:
Note: It *might* be the case that some installations of XP have disabled
the ability to "shell out" (I've heard rumors to this effect - that you can
configure XP this way, but I've never seen an actual instance of it),
Security policy.
but
even then, you should be able to run your program (i.e., the CMD.EXE is
still there, but is somehow made inaccessible to the casual user).


Nope, totally inaccessible.
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt>

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Nov 14 '05 #11


Joona I Palaste wrote:
Stan Weiss <sr*****@erols.com> scribbled the following:
I have a program writeen in Microsoft QC 2.5 for DOS which has a very
simple interface of using printf and sscanf also gets and puts. Is there
an easy way to convert this to Window?


Try using the exact same source code. The functions printf, sscanf, gets
and puts are portable across all implementations.
However please note that the function gets is broken as designed. It is
considered impossible to use safely. You may wish to use fgets instead.

--
/-- Joona Palaste (pa*****@cc.helsinki.fi) ------------- Finland --------\
\-------------------------------------------------------- rules! --------/
"To err is human. To really louse things up takes a computer."
- Anon


You would of course make it a console application.
Nov 14 '05 #12
Mark McIntyre <ma**********@spamcop.net> wrote:
On Mon, 08 Nov 2004 17:38:29 GMT, in comp.lang.c ,
ga*****@yin.interaccess.com (Kenny McCormack) wrote:
Note: It *might* be the case that some installations of XP have disabled
the ability to "shell out" (I've heard rumors to this effect - that you can
configure XP this way, but I've never seen an actual instance of it),


Security policy.


Myeah, but that's not XP's fault. The DOS box _is_ there, but it's
possible for the sysadmin to disable it. This is actually quite a useful
feature - can _you_ trust (all) your users with a DOS prompt?

Richard
Nov 14 '05 #13
Eric Sosman wrote:
Raymond Martineau wrote:
[...] This enters the realm of undefiend behaviour, [...]

What a serendipitous spelling error! We have at last
learned what sort of demons inhabit the nasal passages:
they are the undefiends!


Class! Uh, I mean, Struct!

--
Thomas.
Nov 14 '05 #14
First I would like to Thank every one who has responded. I do not have
XP but the person who said it did not work did have a DOS window. From
what he said it looks like the program stopped at about the point it
would have run a time function.
Stan

Stan Weiss wrote:

I have a program writeen in Microsoft QC 2.5 for DOS which has a very
simple interface of using printf and sscanf also gets and puts. Is there
an easy way to convert this to Window?
Thanks
Stan

Nov 14 '05 #15
Stan Weiss <sr*****@erols.com> wrote:
First I would like to Thank every one who has responded. I do not have
XP but the person who said it did not work did have a DOS window. From
what he said it looks like the program stopped at about the point it
would have run a time function.


Then converting to using Windows-specific output functions isn't likely
to solve the problem, is it?
Maybe your use of the time functions isn't conforming, and invokes UB.
What function would've been called, and how do you call it?

Richard
Nov 14 '05 #16
It was a couple of years ago that this happened and based on his emails
believe it happened when I called this function.

void sleep( int n)
{
timeval = time(NULL);
while ( time(NULL) < timeval + n);
}

Richard Bos wrote:

Stan Weiss <sr*****@erols.com> wrote:
First I would like to Thank every one who has responded. I do not have
XP but the person who said it did not work did have a DOS window. From
what he said it looks like the program stopped at about the point it
would have run a time function.


Then converting to using Windows-specific output functions isn't likely
to solve the problem, is it?
Maybe your use of the time functions isn't conforming, and invokes UB.
What function would've been called, and how do you call it?

Richard

Nov 14 '05 #17
On Tue, 09 Nov 2004 08:15:05 GMT, in comp.lang.c ,
rl*@hoekstra-uitgeverij.nl (Richard Bos) wrote:
Mark McIntyre <ma**********@spamcop.net> wrote:
On Mon, 08 Nov 2004 17:38:29 GMT, in comp.lang.c ,
ga*****@yin.interaccess.com (Kenny McCormack) wrote:
>Note: It *might* be the case that some installations of XP have disabled
>the ability to "shell out" (I've heard rumors to this effect - that you can
>configure XP this way, but I've never seen an actual instance of it),


Security policy.


Myeah, but that's not XP's fault. The DOS box _is_ there, but it's
possible for the sysadmin to disable it. This is actually quite a useful
feature - can _you_ trust (all) your users with a DOS prompt?


If I had my way, when some of my users tried to open a dos prompt, a black
light would light up in black on a black background to tell them not to
click that button again. And then send 20 KV through the mouse, "pour
encourager les autres".

Sorry, I'm training for my BOFH exam... :-)
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt>

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Nov 14 '05 #18

Stan Weiss wrote:

[repaired order]
Richard Bos wrote:
Stan Weiss <sr*****@erols.com> wrote:

First I would like to Thank every one who has responded. I do not have
XP but the person who said it did not work did have a DOS window. From
what he said it looks like the program stopped at about the point it
would have run a time function.
Then converting to using Windows-specific output functions isn't likely
to solve the problem, is it?
Maybe your use of the time functions isn't conforming, and invokes UB.
What function would've been called, and how do you call it?

Richard

[/repaired order]
It was a couple of years ago that this happened and based on his emails
believe it happened when I called this function.

void sleep( int n)
{
timeval = time(NULL);
while ( time(NULL) < timeval + n);
}


yuck! Make this

#include <time.h>

void sleep (int n)
{
time_t reftime = time(NULL);
while (difftime(time(NULL),reftime)<(double) n);
}

(untested). time_t is not necessarily an integer type.
However, there hopefully are better ways of achieving this
than polling.
Please do not top-post.
Cheers
Michael

--
E-Mail: Mine is an /at/ gmx /dot/ de address.
Nov 14 '05 #19
Mark McIntyre (or somebody else) wrote:
Myeah, but that's not XP's fault. The DOS box _is_ there, but it's
possible for the sysadmin to disable it. This is actually quite a useful
feature - can _you_ trust (all) your users with a DOS prompt?


FWIW, that is not a DOS box or DOS prompt. DOS has nothing to do with
it; it's a win32 console window.

Also FWIW, most Windows users are perectly capable of screwing up
their systems with or without the help of the command prompt in
a console window.

Allin Cottrell
Nov 14 '05 #20
In article <cn***********@f1n1.spenet.wfu.edu>,
Allin Cottrell <co******@wfu.edu> wrote:
Mark McIntyre (or somebody else) wrote:
Myeah, but that's not XP's fault. The DOS box _is_ there, but it's
possible for the sysadmin to disable it. This is actually quite a useful
feature - can _you_ trust (all) your users with a DOS prompt?

FWIW, that is not a DOS box or DOS prompt. DOS has nothing to do with
it; it's a win32 console window.


We all understand that, of course, but most people don't.

However, I'd be hard pressed to give an argument as to why the distinction
matters. I.e., it looks and feels like DOS (modulo the differences between
CMD and COMMAND shell syntax; and note that there is a Win95CMD tool that
allows you to use CMD syntax under Win95, etc [DOS based versions of
Windows]). I say this last to head off the argument that "it's not DOS
because the shell syntax is different".

And, note that many people use terminology so sloppily that they call
anything that has a "console"-ish look a "DOS prompt" (I know somebody who
refers to Unix as "a DOS window").
Also FWIW, most Windows users are perectly capable of screwing up
their systems with or without the help of the command prompt in
a console window.


Well said!

Nov 14 '05 #21
On Thu, 11 Nov 2004 22:20:22 -0500, in comp.lang.c , Allin Cottrell
<co******@wfu.edu> wrote:
Mark McIntyre (or somebody else) wrote:
Myeah, but that's not XP's fault. The DOS box _is_ there, but it's
possible for the sysadmin to disable it. This is actually quite a useful
feature - can _you_ trust (all) your users with a DOS prompt?

FWIW, that is not a DOS box or DOS prompt. DOS has nothing to do with
it; it's a win32 console window.


If we're being pedantic, command.com also isn't DOS - its the command
interpreter which runs on top of DOS. You can disable that too.
Also FWIW, most Windows users are perectly capable of screwing up
their systems with or without the help of the command prompt in
a console window.


And most of them wold fsck up their macs and linux boxes just as well. Lets
keep that to alt.advocacy.flames tho shall we?

--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt>

----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
Nov 14 '05 #22
ga*****@yin.interaccess.com (Kenny McCormack) wrote:
In article <cn***********@f1n1.spenet.wfu.edu>,
Allin Cottrell <co******@wfu.edu> wrote:
Mark McIntyre (or somebody else) wrote:
Myeah, but that's not XP's fault. The DOS box _is_ there, but it's
possible for the sysadmin to disable it. This is actually quite a useful
feature - can _you_ trust (all) your users with a DOS prompt?


FWIW, that is not a DOS box or DOS prompt. DOS has nothing to do with
it; it's a win32 console window.


We all understand that, of course, but most people don't.

However, I'd be hard pressed to give an argument as to why the distinction
matters.


In Win9x, the whole "OS" is still built on top of (some kind of) MS-DOS.
Cause creative enough Undefined Behaviour in a DOS application and
you'll be able to crash the entire system. (I know; I've done it :-/ )
In contrast, in XP the command prompt is a separate application within
Windows. Crashing an XP console box shouldn't crash the whole computer;
it should merely lock it tight :-P

Richard
Nov 14 '05 #23

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by Tyler Foreman | last post: by
1 post views Thread by Scott Davies | last post: by
reply views Thread by Scott Davies | last post: by
4 posts views Thread by Rod Gill | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.