[so] Probleme cu Tema 1 SO
Sorin
sorin19840 at yahoo.com
Thu Apr 3 10:35:26 EEST 2008
Si output-ul "gresit" afisat de programul meu e:
output comanda1
output comanda2
output comanda3
>>>
( fara sa scrie si comenzile inainte de output )
Daniel Baluta <daniel.baluta at gmail.com> wrote:
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("\");
aici sigur e asa ?
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, No Cost.
_______________________________________________
so mailing list
so at cursuri.cs.pub.ro
http://cursuri.cs.pub.ro/cgi-bin/mailman/listinfo/so
_______________________________________________
so mailing list
so at cursuri.cs.pub.ro
http://cursuri.cs.pub.ro/cgi-bin/mailman/listinfo/so
---------------------------------
You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://cursuri.cs.pub.ro/pipermail/so/attachments/20080403/06ecc7c3/attachment.htm
More information about the so
mailing list