且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

打开并输出文本文件

更新时间:2023-12-04 15:51:16


大家好,

我想打开一个.txt文件,只是显示它。没有阅读或任何东西,只是在人们输入一定数量时显示它。

有人能告诉我怎么做吗?


并且是否有一个命令可以关闭应用程序的所有窗口?


IM在CORLAND中使用C ++ b



传输 -


这将帮助您打开文件,阅读内容,然后您可以将其打印到屏幕上:

http://www.cplusplus.com/doc/tutorial/files.html

你可以在一段时间内使用case(switch)语句用户输入的循环以及何时显示,如果您需要帮助,请查看thescripts.com的教程:

http://www.thescripts.com/serverside...ops/index.html


这应该可以帮助你开始!


谢谢,但我的意思是打开.txt文件就像你双击它一样。

对不起,如果我没解释好的话!


你知道如何关闭整个程序吗?我试过abort()但是没有给我我想要的东西!


thx已经!!



谢谢,但我的意思是打开.txt文件,就像你双击它一样。

对不起,如果我没解释好的话!


你知道如何关闭整个程序吗?我试过abort()但是没有给我我想要的东西!


thx已经!!



我猜你正在使用Windows,我不完全确定如何打开它 - 因为它涉及打开Word / TextPad的系统命令/记事本打开文件...您可以随时自己打开它并在屏幕上打印(除非您希望某人能够编辑它...)。但这不应该太难以谷歌并找出 - 我猜它会使用''windows.h'来运行任何可执行文件,并可能将文件作为参数发送?我不是一个windows家伙,所以我不太确定......(抱歉!)


您可以通过返回1结束程序或返回0;


Hi everyone,

I want to open a .txt file and just show it.Not for reading or anything but just showing it when people enter a certain number.
Can anyone tell me how to do this?

and is there a command to close all windows of the application?

IM DOING C++ IN BORLAND

Hi everyone,

I want to open a .txt file and just show it.Not for reading or anything but just showing it when people enter a certain number.
Can anyone tell me how to do this?

and is there a command to close all windows of the application?

IM DOING C++ IN BORLAND

Transmit -

This will help you open a file, read stuff in, and then you can print it out to the screen:

http://www.cplusplus.com/doc/tutorial/files.html

You could use a case (switch) statement in a while loop for the user input and when to display, if you need help on that, check out thescripts.com''s tutorial:

http://www.thescripts.com/serverside...ops/index.html

That should get you started!


Thanks, but I actually meant opening the .txt file like when you would double click on it.
Sorry if I didn''t explain well!

and do you know how to close the whole program? I tried abort() but that didn''t gave me what I wanted!

thx already!!


Thanks, but I actually meant opening the .txt file like when you would double click on it.
Sorry if I didn''t explain well!

and do you know how to close the whole program? I tried abort() but that didn''t gave me what I wanted!

thx already!!

I would guess you are using Windows, and I''m not entirely sure how to open it like that - as it involves a system command to open Word/TextPad/Notepad to open the file up... You can always just open it yourself and print it on the screen (unless you want someone to be able to edit it...). But that shouldn''t be too hard to google and find out - I would guess it uses ''windows.h'' to run whatever the executable is, and possibly send the file as a parameter? I''m not a windows guy, so I''m not too sure... (sorry!)

You can end the program through return 1 or return 0;