Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > C++ Programming
|
C++ Programming General discussions for the C++ language. For questions specific to Microsoft's Visual C++ variant, see the Visual C++ forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C++ Programming section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old December 18th, 2009, 12:41 AM
Registered User
 
Join Date: Oct 2009
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default How can I open text file to the screen

Can anybody tell me how to open (print)a text file to the screen. For example, to click a botton and the file will be shown in the screen. Using something like the code below.
private: System::Void ShwCrdBtn_Click(System::Object^ sender, System::EventArgs^ e)

Code:
{
FileInfo^ fi = gcnew FileInfo("C:\\MyFile.txt"); 
fi->OpenRead();
    
 }
Reply With Quote
  #2 (permalink)  
Old August 30th, 2010, 08:32 PM
Registered User
 
Join Date: Jun 2010
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Lightbulb

Read numbers from a text can look more like this:
Code:
inputFile.open("c:\\x\\numbers.txt");
You should also put a check for file error so the program can tell you if it has successfully accessed the text file.
A better example read in numbers from a file C++ full source code for reading numbers from a text file.
Reply With Quote





Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I open text file to the screen autostrad Visual C++ 0 December 18th, 2009 12:34 AM
open a text file azalia Beginning VB 6 1 April 10th, 2007 08:09 AM
Heighlet specific Text when open file in browser salman Classic ASP Databases 0 March 30th, 2004 05:57 AM
Open file with heighlet Particular text salman Classic ASP Databases 0 March 3rd, 2004 08:22 AM
open file with highlet selected text salman Classic ASP Databases 0 February 23rd, 2004 10:54 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.