Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Managed C++/CLI
  4. ifstream & ofstream manipulators equivalents in C++/CLI

ifstream & ofstream manipulators equivalents in C++/CLI

Scheduled Pinned Locked Moved Managed C++/CLI
c++question
4 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    J_E_D_I
    wrote on last edited by
    #1

    ifstream INPUT ("INPUT.csv");
    INPUT << Cell1;
    INPUT.close();

    ofstream OUTPUT ("OUTPUT.csv");
    OUTPUT << Heading1;
    OUTPUT.close();

    Any body could please tell me what are the C++/CLI equivalents for the INPUT / OUTPUT manipulators above? Many thanks.

    N 1 Reply Last reply
    0
    • J J_E_D_I

      ifstream INPUT ("INPUT.csv");
      INPUT << Cell1;
      INPUT.close();

      ofstream OUTPUT ("OUTPUT.csv");
      OUTPUT << Heading1;
      OUTPUT.close();

      Any body could please tell me what are the C++/CLI equivalents for the INPUT / OUTPUT manipulators above? Many thanks.

      N Offline
      N Offline
      N a v a n e e t h
      wrote on last edited by
      #2

      Look at the FileStream[^] class. StreamReader[^] and StreamWriter[^] can also be used. :)

      Navaneeth How to use google | Ask smart questions

      J 1 Reply Last reply
      0
      • N N a v a n e e t h

        Look at the FileStream[^] class. StreamReader[^] and StreamWriter[^] can also be used. :)

        Navaneeth How to use google | Ask smart questions

        J Offline
        J Offline
        J_E_D_I
        wrote on last edited by
        #3

        Thanks a million, that was an excellent source of info. It all works apart from the AddText function below.

        void AddText( FileStream^ fs, String^ value )
        {
        array<Byte>^info = (gcnew UTF8Encoding( true ))->GetBytes( value );
        fs->Write( info, 0, info->Length );
        }

        I have added

        System::IO::

        before

        FileStream

        but the compiler still returns an error regarding the UTF8Encoding... :doh:

        N 1 Reply Last reply
        0
        • J J_E_D_I

          Thanks a million, that was an excellent source of info. It all works apart from the AddText function below.

          void AddText( FileStream^ fs, String^ value )
          {
          array<Byte>^info = (gcnew UTF8Encoding( true ))->GetBytes( value );
          fs->Write( info, 0, info->Length );
          }

          I have added

          System::IO::

          before

          FileStream

          but the compiler still returns an error regarding the UTF8Encoding... :doh:

          N Offline
          N Offline
          N a v a n e e t h
          wrote on last edited by
          #4

          Try this

          array<Byte>^ info = System::Text::Encoding::UTF8->GetBytes(value);

          :)

          Navaneeth How to use google | Ask smart questions

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups