text 1 remains in buffer...nowwhen child reaches print f.....it prints oldbuffer+newdata...m i ryt???
On Sat, Oct 27, 2012 at 4:07 PM, saurabh singh <[email protected]> wrote: > printf is line buffered. hence text1 remains in buffer when fork is > called.this is shared by both the child and the parent when fork is called. > Leaving the rest for u to conclude > > Saurabh Singh > B.Tech (Computer Science) > MNNIT > blog:geekinessthecoolway.blogspot.com > > > > On Sat, Oct 27, 2012 at 2:25 PM, CHIRANJEEV KUMAR < > [email protected]> wrote: > >> I think the output should be : >> >> text1text2 >> text2 >> >> >> >> >> >> On Sat, Oct 27, 2012 at 2:22 PM, rahul sharma <[email protected]>wrote: >> >>> int main() { >>> printf("text1"); >>> fork(); >>> printf("text2\n"); >>> return 0; } >>> >>> the output is: >>> >>> text1text2 >>> text1text2 >>> >>> Please explain o/p >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "Algorithm Geeks" group. >>> To post to this group, send email to [email protected]. >>> To unsubscribe from this group, send email to >>> [email protected]. >>> 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 [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> 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 [email protected]. > To unsubscribe from this group, send email to > [email protected]. > 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
