Thread: programing in DOS?

  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    28

    programing in DOS?

    hi,
    i am a beginner in programming and i have a fair knowledge of what iam doing and i have 1 concern that is, i have been programming in DOS (i use dev c++ compiler) for a while now and iam just wondering can i turn that DOS program i made into a windows application like microsoft word? Or do i have to write that code in a application then run it?

  2. #2
    Hardware Engineer
    Join Date
    Sep 2001
    Posts
    1,398
    Going from console (text based) programming to GUI programming is not as easy as you might think, and it's really not for beginners. There's no simple "make window" command...

    Take a look at The Forger's Windows Programming Tutorial. If you like what you see, get a copy of Programming Windows, by Charles Petzold.

    Your compiler supports the WinAPI, so you can use it to write Windows programs.

  3. #3
    Registered User
    Join Date
    May 2006
    Posts
    12
    Generaly you cant. Win 32 API is different from Ansi C / C++ libraries API. Only functions which not contain any console i/o function are portable to win 32, but win 32 offers its own functions almost for any function in Ansi C / C++ libraries API.

  4. #4
    Registered User
    Join Date
    May 2006
    Posts
    28
    Going from console (text based) programming to GUI programming is not as easy as you might think, and it's really not for beginners. There's no simple "make window" command...

    Take a look at The Forger's Windows Programming Tutorial. If you like what you see, get a copy of Programming Windows, by Charles Petzold.

    Your compiler supports the WinAPI, so you can use it to write Windows programs.
    ouch, is it like learning a whole new language?(ie:there is no cout function?and is something totally different)
    Also what can i achieve from making a DOS program?
    Last edited by k1ll3r; 05-26-2006 at 08:01 PM.

  5. #5
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,613
    Quote Originally Posted by k1ll3r
    ouch, is it like learning a whole new language?(ie:there is no cout function?and is something totally different)
    Also what can i achieve from making a DOS program?
    Quite a lot. There are text based games still around today, and consoles can still make good text editors, syntax checkers, compilers, maybe an anti-virus program, and I'm pretty sure that most (all?) programs can use a console as a base for code.

    If you learn any programming language, really, you start out in the console to get used to and study what you are working with.

    And yes, GUI tools are quite the separate dimension.

  6. #6
    Registered User
    Join Date
    Aug 2005
    Posts
    1,267
    Quote Originally Posted by k1ll3r
    ouch, is it like learning a whole new language?(ie:there is no cout function?and is something totally different)
    Also what can i achieve from making a DOS program?
    have you ever used a text editor, such as Notepad, or Microsoft Word, or used the Dev-C++ code editor? Those and hundreds of others like it are all written using win32 api functions. The win32 api is not another language at all, just an extension of C language much like the cout is an extension of C++ language. Many programmers work for years on just one win32 api program, or set of programs. So don't expect to learn it overnight.

  7. #7
    Registered User
    Join Date
    Mar 2006
    Posts
    725
    Agreed. Don't start until you've mastered the console-based basics like everyone else.
    Code:
    #include <stdio.h>
    
    void J(char*a){int f,i=0,c='1';for(;a[i]!='0';++i)if(i==81){
    puts(a);return;}for(;c<='9';++c){for(f=0;f<9;++f)if(a[i-i%27+i%9
    /3*3+f/3*9+f%3]==c||a[i%9+f*9]==c||a[i-i%9+f]==c)goto e;a[i]=c;J(a);a[i]
    ='0';e:;}}int main(int c,char**v){int t=0;if(c>1){for(;v[1][
    t];++t);if(t==81){J(v[1]);return 0;}}puts("sudoku [0-9]{81}");return 1;}

  8. #8
    Registered User
    Join Date
    May 2006
    Posts
    28
    recently i got a book on c++ for beginners and it says "teaches you everything you need to know to become a professional programmer." So after i read this book (understand it aswell) i would get another book on Win 32 API?

  9. #9
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,613
    Quote Originally Posted by k1ll3r
    recently i got a book on c++ for beginners and it says "teaches you everything you need to know to become a professional programmer."
    The person who wrote this book lied to you.
    So after i read this book (understand it aswell) i would get another book on Win 32 API?
    Yes.

  10. #10
    Been here, done that.
    Join Date
    May 2003
    Posts
    1,164
    Back to the original question:
    Quote Originally Posted by k1ll3r
    ...can i turn that DOS program i made into a windows application like microsoft word?
    Yes if the console-based (DOS) program is written in such a way to help.

    If all input and output is done in functions and these function's only purpose is input or output, they can be replaced by new functions that do I/O to the Windows components instead. Other functions will have to be added to create the windows and windows layouts.

    The rest of the code could work as is since it is the background processing, the real guts of the program, and would have nothing to do with the I/O.
    Definition: Politics -- Latin, from
    poly meaning many and
    tics meaning blood sucking parasites
    -- Tom Smothers

  11. #11
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    Yes if the console-based (DOS) program is written in such a way to help.
    This is the second time I've seen this. A DOS program does NOT mean it is a console program or run in a console window. A DOS program is run by command.com or command which is emulated 16-bit DOS. Nearly every aspect of DOS works in this mode except for loading of drivers into memory using HIMEM.SYS. Also EMM386.EXE does not work as expected since it is not loaded into memory. But if you could load it, and you could if you could boot to command prompt, it would work as well.

    DOS is in XP but not under XP. XP is not built on DOS, but XP does support DOS for the most part.

    Console programs can be made inside of MSVC 6, 2003 and 2005 by simply selecting console for the type of application. However interrupts are NOT allowed and setting of VGA mode is NOT allowed as well as mouse access. You can call Win32 API functions from console mode with no problem. There are ways to do this in DOS via DJGPP and NASM but they are different.

    DOS and console are not synonymous.

    To prove it:

    Download Turbo C++ 1.0, Turbo C++ 3.0 or get Turbo C++ 4.52.
    Create a DOS application just as you normally would back in the day.

    Now create a console app inside of Visual Studio or Borland and see the difference.

    They are not the same.

  12. #12
    Registered User
    Join Date
    Aug 2005
    Posts
    1,267
    The term "DOS" means "Disk Operating System". Most operating systems have them, including MS-DOS, Unix, Linux, MAC, DEC, etc. etc. Just saying "DOS" means absolutely nothing, it's very similar to saying "my car" instead of "my chevy" or "my ford".

  13. #13
    (?<!re)tired Mario F.'s Avatar
    Join Date
    May 2006
    Location
    Ireland
    Posts
    8,446
    However the context of DOS in this discussion was that of the specific operating system MS-DOS

    It is a wrong assumption to believe that programming for the console on any operating system over (and inclusive) Windows 2000 and Windows NT, is programming under MS-DOS. It is not.

    Also a console is not DOS either. Even by your definition.

  14. #14
    Registered User
    Join Date
    Aug 2005
    Posts
    1,267
    Quote Originally Posted by Mario F.
    It is a wrong assumption to believe that programming for the console on any operating system over (and inclusive) Windows 2000 and Windows NT, is programming under MS-DOS. It is not.

    Also a console is not DOS either. Even by your definition.
    Yes, it is a wrong assumtion. MS-Windows command-prompt window is NOT the same as MS-DOS. MS-DOS ceased to exist after Win95.

    Any program that calls cout or printf() is a console program, and most operating systems support them, I know of a few that do not but programs that run on them do not use cout or printf().
    Last edited by Ancient Dragon; 05-27-2006 at 06:35 AM.

  15. #15
    Been here, done that.
    Join Date
    May 2003
    Posts
    1,164
    Quote Originally Posted by Bubba
    Yes if the console-based (DOS) program is written in such a way to help.
    This is the second time I've seen this. A DOS program does NOT mean it is a console program or run in a console window.
    ...
    They are not the same.
    Yes, I'm very well aware of this. But to the OP, I doubt it really matters what the technical differences are, therefore I was responding at his level and didn't feel like explaining the difference. As far as he knew, they were the same. They act the same. They look the same. It's only "under the hood" they are different. And for his question the difference was moot.

    Thank you for the explanation, though. For anyone that needs to know the difference, they now know.
    Definition: Politics -- Latin, from
    poly meaning many and
    tics meaning blood sucking parasites
    -- Tom Smothers

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. File systems?? (Winxp -> DOS)
    By Shadow in forum Tech Board
    Replies: 4
    Last Post: 01-06-2003, 09:08 PM
  2. winver, winminor, winmajor can it be found from dos?
    By ronin in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 10-02-2002, 10:32 AM
  3. real mode dos & win dos
    By scott27349 in forum A Brief History of Cprogramming.com
    Replies: 26
    Last Post: 08-19-2002, 06:15 AM
  4. DOS program versus DOS console program
    By scromer in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 01-10-2002, 01:42 PM
  5. Shut off DOS screen automatically to Windows
    By Unregistered in forum A Brief History of Cprogramming.com
    Replies: 2
    Last Post: 11-08-2001, 07:14 PM