[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: RES: [OFF-TOPIC] Duvida em C



On Wed, Oct 15, 2003 at 01:51:40PM -0300, Kleber Bonassi wrote:
> Olá Alexandre,
> 
> você tem que usar a função strcpy para fazer isto. Por exemplo:

para evitar estouro de buffer, use a strncpy, passando o tamanho máximo
definido na estrutura (ou no vetor).

a sintaxe é parecida:
strncpy(vetor[0].nome, "Poupanca", TAMANHO);
...

veja strncpy(3) para mais informação.

> 
> .
> .
> .
> strcpy(vetor[0].nome, "Poupanca");
> strcpy(vetor[1].nome, "Capitalizacao");
> strcpy(vetor[2].nome, "Acoes");
> strcpy(vetor[3].nome, "Renda Fixa");
> .
> .
> .
> 
> Em Qua 15 Out 2003 13:11, você escreveu:
> > Valeu pega dica, so que ainda to com uma duvida... como eu posso inserir
> > nesse vetor as Strings estaticamente ... ?
> 
> 
> --
> To UNSUBSCRIBE, email to debian-user-portuguese-request@lists.debian.org
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
> 

-- 
Mario O.de Menezes, Ph.D.    "Many are the plans in a man's heart, but
    IPEN-CNEN/SP                is the Lord's purpose that prevails"
http://www.ipen.br/~mario                  Prov. 19.21
    



Reply to: