Jump to content
Fórum Script Brasil
  • 0

manipulação de arquivo


anhaya

Question

1 answer to this question

Recommended Posts

  • 0

http://scriptbrasil.com.br/forum/index.php?showtopic=167549

de uma oçhada, nesse exempl oele faz o que você quer.

Agora precisa estudar bem algumas funções do C:

é isso aqui que você vai precisar fazer

while ( !feof(saida) && achou2 ==5) // mudar o status do arquivo saida
              
            {
              
               fscanf(saida, "%s", &banco2.nome2);
              
               fscanf(saida, "%s", &banco2.status2);
               fseek (saida, 0, SEEK_CUR);
               tamfile2=ftell (saida);
              
               fscanf(saida, "%s", &banco2.cliente2);
              
               fscanf(saida, "%d", &banco2.horas2);
                
               fscanf(saida, "%f", &banco2.valorhora2);
              

               if (strcmpi (nomegarota, banco2.nome2) == 0 ) // Caso já tenha no arquivo saida.txt o nome só mudar o status para A
               {    
                    fseek ( saida , tamfile2-1 , SEEK_SET ); // TAMFILE ARMAZENOU A POSIÇÃO DO STATUS NO TXT
                                  if (op6 == 1)                          //'TAMLIFE-1' É A POSIÇÃO EXATA ONDE FICA O STATUS
                               fputs ( "A" , saida );                  //ASSIM POSSO SUBSTITUIR O STATUS.
                                  if (op6 == 2)
                               fputs ( "D" , saida );
                                  if (op6 == 3)
                               fputs ( "S" , saida );
                               achou2=3;
                              
                               fclose(saida);
               }

precisa disso declarado tb.

fpos_t position; // variavel necessária para uso de algumas funções stdio.h

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      652k
×
×
  • Create New...