[so] Probleme cu Tema 1 SO

Alexandru Mosoi brtzsnr at gmail.com
Thu Apr 3 10:01:42 EEST 2008


probabil vroiai: printf(">");
incearca sa faci flush dupa printf (fflush(stdout)).

2008/4/3 Sorin <sorin19840 at yahoo.com>:

> La Tema 1 SO - mini-shell, considerand urmatorul cod:
> char comanda[100];
> void main()
> {
> while (1)
> {
> printf("\");
> gets(comanda)
> // parsare + executa(comanda);
> if (strncmp(comanda,"exit",4)==0)) break;
> if (strncmp(comanda,"quit",4)==0)) break;
> }
> La rularea interactiva, nu e nici o problema, dar
> daca ai intr-un fisier test.txt de exemplu
> comanda1
> comanda2
> comanda3
> exit
> in loc sa afiseze;
> >comanda1
> output comanda1
> >comanda2
> output comanda2
> >comanda3
> output comanda3
> afiseaza:
> >comanda1
> output comanda1
> comanda2
> output comanda2
> comanda3
> output comanda3
> >>
> ( linia > de prompt nu o pune inaintea comenzii, ci le pune pe toate la
> sfarsit )
> Din cauza asta, programul nu trece nici un test pe site.
> Ai o idee/solutie?
> PS: N-am folosit parserul de pe site. Nu pot folosi pointer si getline.
>
> ------------------------------
> You rock. That's why Blockbuster's offering you one month of Blockbuster
> Total Access<http://us.rd.yahoo.com/evt=47523/*http://tc.deals.yahoo.com/tc/blockbuster/text5.com>,
> No Cost.
> _______________________________________________
> so mailing list
> so at cursuri.cs.pub.ro
> http://cursuri.cs.pub.ro/cgi-bin/mailman/listinfo/so
>
>


-- 
Alexandru Moşoi
http://alexandru.mosoi.googlepages.com

Please avoid sending me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://cursuri.cs.pub.ro/pipermail/so/attachments/20080403/fd805e41/attachment.htm 


More information about the so mailing list