Hi everyone! I'm transferring my C program that I created from Linux to WindowsXP. I would like to know what I need to download/install in Windows in order to compile and successfully run the program? Also, will I need to change some parts of the source code? I used socket programming and MySQL for the C program. Thanks!

Hopefully you will not need to make very many changes to the source code. MS-Windows uses winsock instead of berkley sockets, so you might want to skim through one of the tutorials to see what changes you may need to make.

As for MySql, I don't think you will have to change anything.

What you have to download and install on MS-Windows:
1. A compiler, such as Code::Blocks or VC++ 2010 Express, both are free. Both compilers come with everything you need to write your socket program(s).

2. MySQL server so that you get access to the header files and libraries.

Hopefully you will not need to make very many changes to the source code. MS-Windows uses winsock instead of berkley sockets, so you might want to skim through one of the tutorials to see what changes you may need to make.

As for MySql, I don't think you will have to change anything.

What you have to download and install on MS-Windows:
1. A compiler, such as Code::Blocks or VC++ 2010 Express, both are free. Both compilers come with everything you need to write your socket program(s).

2. MySQL server so that you get access to the header files and libraries.

I didn't quite get this: "MS-Windows uses winsock instead of berkley sockets" Do you mean that the socket(), sendto(), connect(), close, and other commands in socket programming that are used in Linux will be changed to their counterparts in Windows?

Hopefully you will not need to make very many changes to the source code. MS-Windows uses winsock instead of berkley sockets, so you might want to skim through one of the tutorials to see what changes you may need to make.

As for MySql, I don't think you will have to change anything.

What you have to download and install on MS-Windows:
1. A compiler, such as Code::Blocks or VC++ 2010 Express, both are free. Both compilers come with everything you need to write your socket program(s).

2. MySQL server so that you get access to the header files and libraries.

By the way, these are the header files I used for socket programming:
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <errno.h>
Would they still be useful in Windows or do they have counterparts? Thanks

Read the Winsock tutorial and it'll show you how the API is implemented.

One way to make the cod eportable between both *nix and MS-Windows is to use preprocessor instructions, something like this:

#ifdef _WIN32_
#include <winsock2.h>
#else
include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <errno.h>
#endif

One way to make the cod eportable between both *nix and MS-Windows is to use preprocessor instructions, something like this:

#ifdef _WIN32_
#include <winsock2.h>
#else
include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <errno.h>
#endif

I'd like to clarify, when I do the instructions you provided above, will that make my Linux-based program run and compile properly in Windows without editing it?

No -- that will only be the beginning of the changes you need to make. I wouldn't expect there will be very many changes because there are a lot of similarities between the two. In MS-Windows you will have to initialize the socket library and you will find out how to do that in one of the tutorials you need to review.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.