If you go a bit deeper into the system calls that system makes you will realize that the argument is actually expanded as "sh -c echo {abc}{abc}{abc} The expansion facility is provided by bash but not sh.(You may verify my claim) The default shell is bash.*switch to sh mode and you will realize whats happening.*
On Thu, Sep 15, 2011 at 2:43 AM, UTKARSH SRIVASTAV <usrivastav...@gmail.com>wrote: > @rahul have you tried it n your system and if yes then which os? > > > On Thu, Sep 15, 2011 at 2:28 AM, UTKARSH SRIVASTAV < > usrivastav...@gmail.com> wrote: > >> yes it's giving wrong output on terminal using gcc compiler in ubuntu >> >> >> On Thu, Sep 15, 2011 at 1:25 AM, Amol Sharma <amolsharm...@gmail.com>wrote: >> >>> though it is giving the expected output on the ideone but i am not >>> getting the the output on the terminal using gcc compiler it is just >>> printing {a,b,c}{a,b,c}{a,b,c} ............what could be the reason ? >>> >>> my OS- Ubuntu 10.04 >>> @rahul what's ur os ? >>> >>> -- >>> >>> >>> Amol Sharma >>> Third Year Student >>> Computer Science and Engineering >>> MNNIT Allahabad >>> <http://gplus.to/amolsharma99> >>> <http://twitter.com/amolsharma99><http://in.linkedin.com/pub/amol-sharma/21/79b/507><http://youtube.com/amolsharma99> >>> >>> >>> >>> >>> >>> On Thu, Sep 15, 2011 at 1:20 AM, Amol Sharma <amolsharm...@gmail.com>wrote: >>> >>>> http://ideone.com/WQxfK >>>> -- >>>> >>>> >>>> Amol Sharma >>>> Third Year Student >>>> Computer Science and Engineering >>>> MNNIT Allahabad >>>> <http://gplus.to/amolsharma99> >>>> <http://twitter.com/amolsharma99><http://in.linkedin.com/pub/amol-sharma/21/79b/507><http://youtube.com/amolsharma99> >>>> >>>> >>>> >>>> >>>> >>>> On Thu, Sep 15, 2011 at 1:13 AM, rahul vatsa <vatsa.ra...@gmail.com>wrote: >>>> >>>>> i tried ur code & it gives the same output as wen u execute the command >>>>> on terminal. >>>>> >>>>> >>>>> On Wed, Sep 14, 2011 at 3:03 PM, UTKARSH SRIVASTAV < >>>>> usrivastav...@gmail.com> wrote: >>>>> >>>>>> >>>>>> if i write on terminal echo {a,b,c}{a,b,c}{a,b,c} then i get the >>>>>> output all possible combination of a,b,c and if i write like this >>>>>> >>>>>> main() >>>>>> { >>>>>> system("echo {a,b,c}{a,b,c}{a,b,c} "); >>>>>> } >>>>>> output : {a,b,c}{a,b,c}{a,b,c} >>>>>> why? >>>>>> in system command whatever we write is taken like a command >>>>>> >>>>>> >>>>>> -- >>>>>> *UTKARSH SRIVASTAV >>>>>> CSE-3 >>>>>> B-Tech 3rd Year >>>>>> @MNNIT ALLAHABAD* >>>>>> >>>>>> >>>>>> -- >>>>>> You received this message because you are subscribed to the Google >>>>>> Groups "Algorithm Geeks" group. >>>>>> To post to this group, send email to algogeeks@googlegroups.com. >>>>>> To unsubscribe from this group, send email to >>>>>> algogeeks+unsubscr...@googlegroups.com. >>>>>> For more options, visit this group at >>>>>> http://groups.google.com/group/algogeeks?hl=en. >>>>>> >>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "Algorithm Geeks" group. >>>>> To post to this group, send email to algogeeks@googlegroups.com. >>>>> To unsubscribe from this group, send email to >>>>> algogeeks+unsubscr...@googlegroups.com. >>>>> For more options, visit this group at >>>>> http://groups.google.com/group/algogeeks?hl=en. >>>>> >>>> >>>> >>> -- >>> You received this message because you are subscribed to the Google Groups >>> "Algorithm Geeks" group. >>> To post to this group, send email to algogeeks@googlegroups.com. >>> To unsubscribe from this group, send email to >>> algogeeks+unsubscr...@googlegroups.com. >>> For more options, visit this group at >>> http://groups.google.com/group/algogeeks?hl=en. >>> >> >> >> >> -- >> *UTKARSH SRIVASTAV >> CSE-3 >> B-Tech 3rd Year >> @MNNIT ALLAHABAD* >> >> >> > > > -- > *UTKARSH SRIVASTAV > CSE-3 > B-Tech 3rd Year > @MNNIT ALLAHABAD* > > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algogeeks@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com. > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > -- Saurabh Singh B.Tech (Computer Science) MNNIT ALLAHABAD -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.