TDIIII Posted October 15, 2009 at 10:23 PM Report Share #291840 Posted October 15, 2009 at 10:23 PM O meu problema é o seguinte: O utilizador digita no teclado por exemplo "ola mundo" com fgets passo essa string para um vector mas depois queria copiar so parte da string ou seja queria copiar so o "ola" para um vector e o "mundo" para outro vector ja tentei com o strcpy so que nao tou a conseguir fazer a função agradecia se alguem me podia dar um exemplo Link to comment Share on other sites More sharing options...
Tharis Posted October 15, 2009 at 10:28 PM Report Share #291841 Posted October 15, 2009 at 10:28 PM Vê o código que está nesta página. Cumps 🙂 Link to comment Share on other sites More sharing options...
TDIIII Posted October 15, 2009 at 11:03 PM Author Report Share #291851 Posted October 15, 2009 at 11:03 PM int main(){ char str1[]="Sample string"; char str2[40]; while (fgets(str1)!=' '){ strcpy (str2,str1); } printf ("str1: %s\nstr2: %s\nstr3: %s\n",str1,str2,str3); return 0; } fgets esta incompleto mas eu queria neste caso por o "sample" num vector e o "string" noutro vector mas nao sei como Link to comment Share on other sites More sharing options...
TDIIII Posted October 18, 2009 at 11:42 PM Author Report Share #292266 Posted October 18, 2009 at 11:42 PM Niguem me pode ajudar? Link to comment Share on other sites More sharing options...
Triton Posted October 19, 2009 at 12:17 AM Report Share #292268 Posted October 19, 2009 at 12:17 AM Niguem me pode ajudar? http://www.cplusplus.com/reference/clibrary/cstring/strtok/ <3 life Link to comment Share on other sites More sharing options...
Triton Posted October 19, 2009 at 06:54 PM Report Share #292401 Posted October 19, 2009 at 06:54 PM Qual dos dois sites recomendam? O que eu disse está mais completo. <3 life Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now