Jump to content
  • 0

pomoc File Functions


Fallen

Dotaz

Guten Morgen ! :d

Nazdar.

Našiel som pár dobrých idea na samp fóru čo si dať do módu, ale kedže nechcem byť COPY, tak si to chcem spraviť sám, btw. chyby jak v vody v mori. Snažil som sa spraviť niečo také, že číta riadky zo súboru, a ak ich je tam viac ako 10, tak riadky nad 10 zmaze. Skúšal som to cez fwrite a fread. Ale moja hlava na to nestačí.

Takže by som Vás tu chcel poprosiť o niaky ten príklad. Danke


Mám to ..:

fdeleteline(filename[], line)
{
  new count, string[256], File:file, File:temp;

  file= fopen(filename, io_read);
  temp = fopen("tmpfile.tmp", io_write);

  while (fread(file, string))
    if (++count != line)
      fwrite(temp, string);

  fclose(file);
  fclose(temp);

  file= fopen(filename, io_write);
  temp = fopen("tmpfile.tmp", io_read);

  while (fread(temp, string))
    fwrite(file, string);
	
  fclose(file);
  fclose(temp);
  fremove("tmpfile.tmp");
}

LOCK

Link to comment
Share on other sites

0 odpovědí na tuto otázku

Recommended Posts

There have been no answers to this question yet

Guest
This topic is now closed to further replies.
×
×
  • Create New...