Pipe Function in Unix to Visual C

Hello friends i am trying to develop a code in Visual C. I want to convert the program from Unix platform to the Windows Platform

To display the PGM files the code in Unix Platform is this :

#include <string.h>
#include “unistd.h”
#include <stdio.h>
#include <math.h>

void DisplayPGM(unsigned char *im, int x, int y, char *title)
{
char t[30];
int pid, pfd[2];

if(pipe(pfd) == -1) printf(“pipe”);
if((pid = fork()) == -1) printf(“fork”);
else if (pid == 0)
{
if(close(0) == -1) printf(“close”);
if(dup(pfd[0]) != 0) printf(“dup”);
if(close(pfd[0]) == -1 || close(pfd[1]) == -1) printf(“close2”);
execlp("/usr/local/bin/xv",“xv”,"-","-name",title, NULL);
}
if(close(pfd[0]) == -1) printf(“close3”);
sprintf(t,“P5\n %d %d\n 255\n”, x, y);
if(write(pfd[1],t,strlen(t)) == -1) printf(“write1”);
if(write(pfd[1],im,x*y) == -1) printf(“write2”);
if(close(pfd[1]) == -1) printf(“close4”);
}

Is there any header file or alternate code which i can use on the Visual C platform to execute this. As pipe and fork doesn’t work on the Visual C platform

Thanks

Anuj