know yourselves. information, computer, 7 wonders, various.

Monday, November 6, 2017

C++ programming language part- 65 Writing and Reading character using binary functions


Writing and Reading character using binary functions

In C++ there are some binary I/O functions such as get(), getline() and read() can be used when the programmer wishes to read white space characters also. The enter file input and output are text- or character-based. Usually , white space cheracter are omitted.




The put() function

The put() and get() functions, which are members of ostream and istream, are used to output and input a single character at a time. The following program writes one character at a time to a file.

Program 46_8
            //inherit.demo
            #include
            #include
            #include // for strlen()

            char cstr[]="Careless Whisper";
            void main()
            {
            ofstream ofil("careless.txt");
            int p;
              for(p=0;p
              {
               ofil.put(cstr[p]);     // put is a member of ofstream
              }
              ofil.put('\0');

            }

            // open this text file and watch information using notepad




জ্ঞানকোষ প্রকাশনী
৩৮/২-ক, বাংলাবাজার (২য় তলা), ঢাকা।
       ফোনঃ ৭১১৮৪৪৩, ৮১১২৪৪১, ৮৬২৩২৫১.         
                                                     
কলকাতায় পরিবেশক/প্রাপ্তিস্থান
রিতা ইন্টারন্যাশনাল
৩৬, পি.এন. ব্যানার্জি রোড, কলকাতা
ফোনঃ ২৫১৩৮৩৫৯, ৯৮৩০৪৩৯৬৭৯, +৯১৯৮৩০৪৩৯৬৭৯



C++ programming language part- 66 The get() function


The get() function

The following program reads the string from the file character using the binary function get(),

Program 46_9
            //inherit.demo
            #include
            #include
            #include // for strlen()

            char cstr2;
            void main()
        {
            ifstream ifil("careless.txt");
            while(ifil)
              {
               ifil.get(cstr2);     // get is a member of ofstream
           cout<

              }
            }


            // open this text file and watch information using notepad


Part- 86 assign the content of twostring


জ্ঞানকোষ প্রকাশনী
৩৮/২-ক, বাংলাবাজার (২য় তলা), ঢাকা।
       ফোনঃ ৭১১৮৪৪৩, ৮১১২৪৪১, ৮৬২৩২৫১.         
                                                     
কলকাতায় পরিবেশক/প্রাপ্তিস্থান
রিতা ইন্টারন্যাশনাল
৩৬, পি.এন. ব্যানার্জি রোড, কলকাতা
ফোনঃ ২৫১৩৮৩৫৯, ৯৮৩০৪৩৯৬৭৯, +৯১৯৮৩০৪৩৯৬৭৯