Google Answers Logo
View Question
Q: migrating Linux to Win32 ( Answered,   1 Comment )
Subject: migrating Linux to Win32
Category: Computers > Programming
Asked by: dre1234-ga
List Price: $2.00
Posted: 25 Feb 2005 23:58 PST
Expires: 27 Mar 2005 23:58 PST
Question ID: 481151
I want to migrate a simple C program from Linux to a win32 console
application (simple i/O).
Is it as simple as just #includ'ing the window.h library?   
#ifdef WIN32
#include <windows.h>
Subject: Re: migrating Linux to Win32
Answered By: efn-ga on 26 Feb 2005 08:56 PST
Hi dre1234,

It may be even simpler than that.  If the program is limited to
standard, platform-independent functions, you shouldn't need to change
it at all.  It doesn't really matter whether the program is simple or
complex--the key is what library functions it uses.

You don't need the windows.h header file in a console application on Windows.

I hope this helps.  If you need more information, please ask for a clarification.


Request for Answer Clarification by dre1234-ga on 26 Feb 2005 13:39 PST
What are the functions?  My program uses getchar(), cin & cout.  
I don't have access to a Windows computer or Visual C++ to test the program.  

I'll look on the Internet, but let me know asap.  Its part of an entry
test for a job & just don't want to get it submitted asap.

I waded through so much crap on the Internet, it was worth the $2.50 in time alone.

Clarification of Answer by efn-ga on 26 Feb 2005 14:57 PST
The safe functions are the ones in the standard library.

getchar should be fine.

cin and cout are standard in C++, but not in C, which was the language
specified in your question.  If you are familiar with C++ and trying
to write C, you will have to get rid of them, but if you are actually
writing C++, they are fine.

Dinkumware has good on-line references to the standard C and C++
libraries, though you must wade through their admonishments not to
steal them.
Subject: Re: migrating Linux to Win32
From: eliteskillsdotcom-ga on 26 Feb 2005 09:02 PST
Pretty much.

Try this:

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  

Google Home - Answers FAQ - Terms of Service - Privacy Policy