<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>主控台應用程式 on Lin's Blog</title><link>http://coder.tw/tags/%E4%B8%BB%E6%8E%A7%E5%8F%B0%E6%87%89%E7%94%A8%E7%A8%8B%E5%BC%8F/</link><description>Recent content in 主控台應用程式 on Lin's Blog</description><generator>Hugo</generator><language>zh-tw</language><lastBuildDate>Sat, 04 Dec 2010 10:00:16 +0000</lastBuildDate><atom:link href="http://coder.tw/tags/%E4%B8%BB%E6%8E%A7%E5%8F%B0%E6%87%89%E7%94%A8%E7%A8%8B%E5%BC%8F/index.xml" rel="self" type="application/rss+xml"/><item><title>【C++】用CMD傳送檔案給主控台應用程式以及傳回資料</title><link>http://coder.tw/posts/c-cmd-send-file-to-console-app-2/</link><pubDate>Sat, 04 Dec 2010 10:00:16 +0000</pubDate><guid>http://coder.tw/posts/c-cmd-send-file-to-console-app-2/</guid><description>&lt;p style="text-align: center;"&gt;&lt;a href="https://pub-6c026d2742d14927bfa2d850c31eac91.r2.dev/wp-content/uploads/2010/11/2010-11-26_232836.jpg"&gt;&lt;img class="size-large wp-image-4097 aligncenter" title="2010-11-26_232836" src="https://pub-6c026d2742d14927bfa2d850c31eac91.r2.dev/wp-content/uploads/2010/11/2010-11-26_232836-520x365.jpg" alt="" width="520" height="365" /&gt;&lt;/a&gt;&lt;/p&gt;
其實在C++裡面除了單純的使用fopen來讀取檔案之外,還有另外一種方法也可以讀取檔案,而且實作起來比fopen簡單很多,那就是利用cmd來餵檔案給C++程式,舉例來講現在有一個程式叫做test.exe,還有一個txt檔叫做x.txt,然後我要讓test.exe讀取x.txt的資料並顯示出來,則我開啟CMD,然後再裡面輸入 &lt;em&gt;&lt;strong&gt;test.exe&amp;lt;x.txt&lt;/strong&gt;&lt;/em&gt; 就可以讀取並顯示出x.txt的內容了,下面文章要教大家的就是這種讀取檔案的方式,另外感謝網友滄海教會我這種用法</description></item></channel></rss>