First, look at your data file, and decide how it is organised: if it contains "integers" then you need to find out how it's actually stored.
For example:
1234
5678
9012
is probably string representation of integers, not "integers" per se. To read those, you need to read lines to establish where integers start and finish, and identify the final character of each value in order to decide if the integer number is even or odd.
Even if it's stored differently, you will need to do something similar, as it';s very unlikely that each integer is stored in a directly useful format.
And do yourself a favour: indent your code!
It's a lot easier to work out what is happening if you indent it:
for(i=0;i<n;i++)
{
if(buf[i]%2==0)
{
write(fd2,buf,n);
}
else
{
write(fd3,buf,n);
}
}
Is much easier to work with than
for(i=0;i<n;i++)
{
if(buf[i]%2==0)
{
write(fd2,buf,n);
}
else
{
write(fd3,buf,n);
}
}