How to use "File" library in Console C++?

This is a discussion on How to use "File" library in Console C++? within the C# Programming forums, part of the General Programming Boards category; I want to input and output file.I used some declarations are using namespace System; using namespace System.IO; but compiler don't ...

  1. #1
    Registered User
    Join Date
    Sep 2006
    Posts
    52

    How to use "File" library in Console C++?

    I want to input and output file.I used some declarations are
    using namespace System;
    using namespace System.IO;
    but compiler don't understand about them.Please show me way to using them
    I want to use "StreamWriter" function to input and output files...

  2. #2
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    These things don't exist in C++. Use iostreams instead, in particular std:fstream.

    You're looking for C++/CLI functionality. Create a Managed or .Net project for that.

    But I recommend you stay with C++.

    On a second look, this actually seems to be C# code you have there. Even worse! There's a different forum for that here.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  3. #3
    Anti-Poster
    Join Date
    Feb 2002
    Posts
    1,399
    Code:
    using System;
    using System.IO;
    If I did your homework for you, then you might pass your class without learning how to write a program like this. Then you might graduate and get your degree without learning how to write a program like this. You might become a professional programmer without knowing how to write a program like this. Someday you might work on a project with me without knowing how to write a program like this. Then I would have to do you serious bodily harm. - Jack Klein

  4. #4
    Registered User
    Join Date
    Sep 2006
    Posts
    52
    I'm using Visual Studio C++ Express Edition.In MSDN document,these codes are in part of C++,not in C#...

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Linker errors in VC++ 2005
    By C+/- in forum C++ Programming
    Replies: 0
    Last Post: 05-18-2007, 08:42 AM
  2. Full Screen Console
    By St0rmTroop3er in forum C++ Programming
    Replies: 1
    Last Post: 09-26-2005, 10:59 PM
  3. Problems with a simple console game
    By DZeek in forum C++ Programming
    Replies: 9
    Last Post: 03-06-2005, 02:02 PM
  4. Console Functions Help
    By Artist_of_dream in forum C++ Programming
    Replies: 9
    Last Post: 12-04-2004, 03:44 AM
  5. Linux console window questions
    By GaPe in forum Linux Programming
    Replies: 1
    Last Post: 12-28-2002, 12:18 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21