Přidat otázku mezi oblíbenéZasílat nové odpovědi e-mailem C - citanie retazca zo subora.

Dobry den mam mensi problem v citani retazca ktory obsahuje medzery zo subora.
Priklad retazca: Steven Spielberg
V subore sa dostanem na aktualny riadok s retazcom a zavolam funkciu fgets(autoriNacitaj,sizeof(autoriNacitaj),fr);
Problem je ze tato funkcia nacitava tolko kolko som jej zadal znakov. Ale velkosti mien autorov sa mozu lisit a tak sa mi stane ze ak je meno kratsie zobere uz dalsi retazec v novom riadku v subore. Neviete ako by sa to dalo efektivne napravit?

Předmět Autor Datum
fgets() reads in at most one less than size characters from stream and stores them into the buffer p… poslední
gilhad 28.11.2015 13:39
gilhad

fgets() reads in at most one less than size characters from stream and stores them into the buffer pointed to by s. Reading stops after an EOF or a newline. If a newline is read, it is stored into the buffer. A terminating null byte ('\0') is stored after the last character in the buffer.

pokud je AutoriNacitaj dost velke, melo by ti nacist celou radku a pak si to uz sam rozdelis na jmeno, prijmeni, stredni jmeno, pridomky a dalsi ocasky

Priklad retezce: JUDr. PhDr. Mgr. et Mgr.Henryk Lahola henryklahola.nazory.cz

Zpět do poradny Odpovědět na původní otázku Nahoru