질문 내용 그대로입니다.
파일에 내용을 출력하려는데 이미 해당 파일이 있는지 확인하는 부분 좀 알려 주세요..
저번에 이와 관련된 질문을 했는데 그 때 잊고 질문을 적지 못했습니다.
현재 갖고 있는 책이 부실합니다.
내용이 더 풍부한 C++ 책을 한 권 사야겠어요..
컴파일러는 Borland C++ 3.1입니다. (꽤 오래된 것이죠..)
CRT의 _access를 쓰세요.
#include <io.h> ... if (_access("C:\\test.ini", 0) == -1) printf("파일 있다\r\n"); else printf("파일 있지롱~\r\n");
</span> <code class="bb-code"> FILE *fp = fopen("c:\\data.txt", "rb"); printf( fp ? "exist.\n" : "not exist.\n" ); 혹은 int nFD = open ("c:\\data.txt", _O_RDONLY ); printf( nFD > 0 ? "exist.\n" : "not exist.\n" ); </code> <span>[c++ style]</span> <code class="bb-code"> ifstream in( "c:\\data.txt", ios::in | ios::binary ); printf( in.is_open() ? "exist.\n" : "not exist.\n" ); </code>
- 인생은 스스로 -
텍스트 포맷에 대한 자세한 정보
<code>
<blockcode>
<apache>
<applescript>
<autoconf>
<awk>
<bash>
<c>
<cpp>
<css>
<diff>
<drupal5>
<drupal6>
<gdb>
<html>
<html5>
<java>
<javascript>
<ldif>
<lua>
<make>
<mysql>
<perl>
<perl6>
<php>
<pgsql>
<proftpd>
<python>
<reg>
<spec>
<ruby>
<foo>
[foo]
CRT의 _access를 쓰세요.[code:1]#include &
CRT의 _access를 쓰세요.
acess, stat 그리고...
- 인생은 스스로 -
댓글 달기