Fgetchar & Fseek
#1

Two bugs regarding the file.inc in the SA-MP package:

1. fgetchar is not correctly "natived" in file.inc:
Код:
native fgetchar(File: handle, value, bool: utf8 = true);
This should be:
Код:
native fgetchar(File: handle, bool: utf8 = true);
This could be used like this:
Код:
new character = fgetchar(file, false);
Source, fgetchar worked properly after using the new version.



2. fseek doesn't return any number, it always returns 0, even when the file has the required amount of characters. But the new file location is set.
Код:
new pos = fseek(file, 50, seek_start);
printf("file position = %i", pos);
That will print "file position = 0", but if I do this:
Код:
fseek(file, 50, seek_start);
fputchar(file, 'x', false);
Then it will put an X character at the 50th spot in the file.
Reply
#2

1. who cares? i never used that function in 2 years
it doesnt return anything so how u gonna get its return value? just leave it.. doesnt matter

2. new newpos = 50;
fseek(file, newpos, seek_start);
printf("file position = %i", newpos);

lol is it such a big deal tho? i dont think so..
Reply
#3

Quote:
Originally Posted by mastermax7777
Посмотреть сообщение
1. who cares? i never used that function in 2 years
it doesnt return anything so how u gonna get its return value? just leave it.. doesnt matter
I care, but it doesn't matter who's caring. We can report bugs here and this is a bug right? Besides that, it does return something. You're probably looking at the Wiki, which says it returns nothing. That's probably put there because the writer assumed it returned nothing, but never tested it. (But I don't blame him.)

Quote:
Originally Posted by mastermax7777
Посмотреть сообщение
2. new newpos = 50;
fseek(file, newpos, seek_start);
printf("file position = %i", newpos);

lol is it such a big deal tho? i dont think so..
Yes, that's a possibility, of course. But it makes this completely invalid and incorrect:
Quote:
Note: To get the current file position without changing it, set the position parameter to zero and whence to seek_current.

This is stated both on the Wiki and in the Pawn File I/O manual.
Reply
#4

I don't remember where exactly said ****** that if found a bug and you can fix it then do it and share to others
how I see its not big problem
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)