fread problem
#1

hello to everyone. First sorry for my bad english.
My problem is the following ... I made a function to write to a file only when it reaches the loop while not working and not enough on the "print (" loop While ");":

pawn Код:
while(fread (file, strl, sizeof (strl)))
(
  print( "loop While");
I think it's because of the fread function. Is that it? Can help?
Thanks, and sorry if the question is being repeated, unable to solve my doubts following the information found.
Reply
#2

Check the fopen methods.
Reply
#3

file = fopen(filename, io_read);
//file2 = fopen(filename, io_append);
I use this example:
https://sampwiki.blast.hk/wiki/File_Functions
Reply
#4

The problem continues
Reply
#5

HELP PLEASE!!!!111
Reply
#6

I need help, please.
Reply
#7

no need to post 4 times in a row..


Код:
new File: file, data[256];
file = fopen("put_filename_here", io_read);

while (fread(file,data))
{
  // funky bit goes here
}
fclose(file);
edit: also make sure the file exists
Reply
#8

I did exactly this, but the error continues.
Reply
#9

fread is bugged?
Reply
#10

I read your first post again, you made a function that would write to a file, but then why would you bother with fread? since that only reads data from a file, it won't write anything to it, and you definatly can't do
Код:
while(fwrite(file,params));
that would be a never ending loop, and you also didn't open the file in a writing mode. Maybe you should take a look at a few references, if you still can't figure it out, please post your code and the error you're getting.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)