Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.

feof() daje TRUE? WHY?

[es] :: C/C++ programiranje :: feof() daje TRUE? WHY?

[ Pregleda: 2274 | Odgovora: 2 ] > FB > Twit

Postavi temu Odgovori

Autor

Pretraga teme: Traži
Markiranje Štampanje RSS

stale85
Stanislav Antic
Student
Sremčica

Član broj: 6670
Poruke: 120
*.vdial.verat.net



Profil

icon feof() daje TRUE? WHY?25.05.2004. u 22:09 - pre 242 meseci
Imam sledeci problem. Napisao sam program koji treba da mi izbaci nepotrebne linkove iz fajla input_file i da ih upise u output_file. Posto sa komandom emerge -pvf some_package (koristim inace gentoo linux) dobijam gomilu adresa, a meni treba fajl bez duplirajucih adresa tako da kada zelim da negde na brzinu skinem sve te fajlove, da importujem linkove. Ali za while(feof(input_file)) dobijam nulu kao da je vec vpos_t postavljen na kraj fajla, a tek sam ga otvorio sa f-jom fopen(argv[argn-2], "r"). Inace prilazem kompletan source. Prilozio sam i fajl koji bi trebalo skratiti, ako zelite da isprobate program.
Ken Thompson has an automobile which he helped design. Unlike most automobiles, it has neither speedometer, nor gas gauge, nor any of the other numerous idiot lights which plague the modern driver. Rather, if the driver makes a mistake, a giant “?” lights up in the center of the dashboard. “The experienced driver,” says Thompson, “will usually know what’s wrong.”
Prikačeni fajlovi
 
Odgovor na temu

filmil
Filip Miletić
Oce Technologies B.V., inženjer
hardvera
Arcen, NL

Član broj: 243
Poruke: 2114
*.adsl.zonnet.nl

Jabber: filmil@jabber.org
ICQ: 36601391


+3 Profil

icon Re: feof() daje TRUE? WHY?25.05.2004. u 22:13 - pre 242 meseci
Možda bi umesto toga što si zamislio mogao da probaš kombinaciju programa sort i uniq.

(man sort, man uniq)

Takođe mislim da petlja treba da glasi:

while (!feof(...)) iliti dok nije dosegnut kraj datoteke...

f
 
Odgovor na temu

stale85
Stanislav Antic
Student
Sremčica

Član broj: 6670
Poruke: 120
*.vdial.verat.net



Profil

icon Re: feof() daje TRUE? WHY?26.05.2004. u 08:53 - pre 242 meseci
Da pogresio sam kod feof, ali i kod pointera. Procitacu vise o njima pa nece biti vise zabune. Hvala ti na trudu.
Ken Thompson has an automobile which he helped design. Unlike most automobiles, it has neither speedometer, nor gas gauge, nor any of the other numerous idiot lights which plague the modern driver. Rather, if the driver makes a mistake, a giant “?” lights up in the center of the dashboard. “The experienced driver,” says Thompson, “will usually know what’s wrong.”
 
Odgovor na temu

[es] :: C/C++ programiranje :: feof() daje TRUE? WHY?

[ Pregleda: 2274 | Odgovora: 2 ] > FB > Twit

Postavi temu Odgovori

Navigacija
Lista poslednjih: 16, 32, 64, 128 poruka.