Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include<string.h>
- int main ()
- {
- char comandao [2500];
- scanf("%s", comandao);
- char *p ;
- int aux, cont;
- cont = 0;
- {
- /* Contador de ; */
- for (aux=0; comandao[aux] != '\0'; aux++)
- {
- if ( comandao[aux] == ';' )
- cont = cont +1;
- }
- cont = cont+1;
- /*comando em si*/
- while (cont > 0)
- {
- p = strchr(comandao, ';');
- int tamanhao, tamaninho , tamanhedio;
- tamanhao = strlen(comandao);
- printf("%d \n", tamanhao);
- tamanhedio = strlen(p);
- printf("%d \n", tamanhedio);
- tamaninho = tamanhao - tamanhedio;
- printf("%d \n", tamaninho);
- char comando1 [50];
- strncpy(comando1, comandao , tamaninho);
- comando1[tamaninho]='\0';
- printf("%s \n", comando1);
- memset(comando1,0,50);
- cont = cont - 1;
- p++;
- strcpy(comandao,p);
- puts(comandao);
- }
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment