gotoxy
低レベルのファイル コピー プログラムに関数を含めると、エラーが発生します。
これがコードです
#include<stdio.h>
#include"d:\types.h"
#include"d:\stat.h"
#include"d:\fcntl.h"
#include<windows.h>
void gotoxy(int x, int y)
{
COORD coord;
coord.X = x;
coord.Y = y;
SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), coord);
}
main()
{
int inhandle,outhandle,bytes;
char buffer[512],source[128],target[128];
printf("enter source file location\n");
scanf("%s",source);
printf("enter target file name with location\n");
scanf("%s",target);
inhandle=(source,O_BINARY,O_RDONLY);
if(inhandle==-1)
{
printf("cannot open source file\n");
}
outhandle=(target,O_CREAT,O_BINARY|O_WRONLY,S_IWRITE);
if(outhandle==-1)
{
printf("cannot create target file");
}
while(1)
{
bytes=read(inhandle,buffer,512);
if(bytes>1)
{
write(outhandle,buffer,bytes);
}
}
close(inhandle);
close(outhandle);
}
c-free ver5.0 コンパイラで発生するエラー一覧
--------------------Configuration: mingw5 - CUI Debug, Builder Type: MinGW--------------------
Compiling D:\c\test4.c...
[Error] C:\PROGRA~2\C-FREE~1\mingw\include\stdlib.h:293: error: conflicting types for '_fmode'
[Error] d:\fcntl.h:107: error: previous declaration of '_fmode' was here
[Error] C:\PROGRA~2\C-FREE~1\mingw\include\stdlib.h:293: error: conflicting types for '_fmode'
[Error] d:\fcntl.h:107: error: previous declaration of '_fmode' was here
[Warning] D:\c\test4.c:43:2: warning: no newline at end of file
Complete Compile D:\c\test4.c: 4 error(s), 1 warning(s)
私は何を間違っていますか?コードを正常にコンパイルするにはどうすればよいですか?