CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Jun 2010
    Posts
    9

    replacement for fscanf and fprintf in managed c++

    Hello
    thanks for the previous reply, it was helpful
    In the way can i know the replacement for fscanf and fprintf in managed c++
    thanks in advance
    regards
    jalaja

  2. #2
    Join Date
    Jun 2010
    Location
    Germany
    Posts
    2,675

    Re: replacement for fscanf and fprintf in managed c++

    To handle files in text mode in C++/CLI you can use the StreamReader and StreamWriter classes.

    StreamWriter has lots of overloaded versions of the Write() method that write text representations of various CTS types to the output file. This is, however, still no direct replacement for the formatting capabilities of fprintf(), but you may use String::Format() like I pointed out in the other thread and write the string obtained by that to the file.

    And like for console I/O there is no direct replacement for fscanf(), but you can use StreamReader to read the text and then process this using the Parse() methods of the various CTS types as also explained in the other thread.

    HTH
    I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.

    This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.

  3. #3
    Join Date
    Jun 2010
    Posts
    9

    Re: replacement for fscanf and fprintf in managed c++

    thank u
    regards
    jalaja

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured