27.02.2009, 21:36
Hello.
I tried to create my own fopen function..
But anything I do just dont work.
It's always give warning(s) because the function / variables tag.
Here is the function:
I tried to use "File:" before the function name... still not work.
Thanks for helpers.
Amit_B
I tried to create my own fopen function..
But anything I do just dont work.
It's always give warning(s) because the function / variables tag.
Here is the function:
pawn Код:
stock file_open(fname[],mode=1)
{
if(!isValidFName(fname)) return -1, printf("ERROR: invalid file name (file_open(\"%s\",%d))",fname,mode);
if(!fexist(fname) && mode != 1 && mode != 4) return -2, printf("ERROR: file not exist (file_open(\"%s\",%d))",fname,mode);
new filemode:fMod = io_write;
switch(mode)
{
case 1: fMod = io_write;
case 2: fMod = io_append;
case 3: fMod = io_read;
case 4: fMod = io_readwrite;
}
new File:f = fopen(fname,fMod);
if(!f) return 0;
return f;
}
Thanks for helpers.
Amit_B