como ler campos usando a linguagem c????

12 views
Skip to first unread message

Ivan lopes

unread,
Dec 21, 2009, 2:44:56 AM12/21/09
to ccppb...@googlegroups.com
arquivo de entrada:

$ head diario_de_aula.txt
ALEXANDRE MIRANDA DEMANTOVA                        | 05 | 02 | 05 |
ALEXANDRE MORALES DIAZ                             | 02 | 06 | 17 |
ALEX GONÇALVES                                     | 05 | 02 | 05 |
ALEXIA LUIZI PEREIRA                               | 02 | 06 | 17 |
ALINE VICENTE KUNST                                | 05 | 02 | 05 |
ALLANA BOTARIO GARCIAS                             | 02 | 06 | 17 |
AMANDA RIBEIRO DE JESUS                            | 05 | 02 | 05 |
ANA CAROLINA RACHADEL                              | 02 | 06 | 17 |
ANANDA DIAS BORDIGNON                              | 05 | 02 | 05 |
ANANDA TONELINI DE PAIVA SAMPAIO                   | 02 | 06 | 17 |



tentei scanf, mas nao sei criar as macros ...
caso alguem saiba a resposta, agradeco adiantadamente qualquer dica ...

Ivan lopes

unread,
Dec 21, 2009, 3:38:00 AM12/21/09
to ccppb...@googlegroups.com
consegui ... usei regex
fscanf(sourceFile, "%[^|\n]%*[ |]%[^|\n]%*[|]%[^|\n]%*[|]%[^|\n]|%*[\n]",
        fild1,
        fild2,
        fild3,
        fild4);

2009/12/21 Ivan lopes <lopesi...@gmail.com>
Reply all
Reply to author
Forward
0 new messages