C++Builder Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
C++빌더 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
메신저 프로젝트
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
볼랜드포럼 광고 모집

C++빌더 Q&A
C++Builder Programming Q&A
[20739] Re:[질문] handle값을 사용해서 filename을 알수 있는 함수 없나요?ㅠ.ㅠ
 구 [urbane9] 1206 읽음    2002-08-10 22:17
파일 이름을 얻어오는거 어려울거 같구요...
파일이름을 제외한 다른 정보는 얻어올수 있을거 같네요.
빌더 도움말에서 "file information" 또는 man.kldp.org에서 stat로 검색을 하시면
아래와 같은 내용을 보실 수 있습니다.

-빌더 도움말-
Header File

sys\stat.h

Category

Input/output Routines

Prototype

int fstat(int handle, struct stat *statbuf);

int stat(const char *path, struct stat *statbuf);

int _wstat(const wchar_t *path, struct stat *statbuf);

Description

Gets open file information.

fstat stores information in the stat structure about the file or directory associated with handle.

stat stores information about a given file or directory in the stat structure. The name of the file is path.

statbuf points to the stat structure (defined in sys\stat.h). That structure contains the following fields:

st_mode    Bit mask giving information about the file's mode
st_dev    Drive number of disk containing the file or file handle if the file is on a device
st_rdev    Same as st_dev
st_nlink    Set to the integer constant 1
st_size    Size of the file in bytes
st_atime    Most recent access (Windows) or last time modified (DOS)
st_mtime    Same as st_atime
st_ctime    Same as st_atime

The stat structure contains three more fields not mentioned here. They contain values that are meaningful only in UNIX.

The st_mode bit mask that gives information about the mode of the open file includes the following bits:

One of the following bits will be set:

S_IFCHR    If handle refers to a device.
S_IFREG     If an ordinary file is referred to by handle.

One or both of the following bits will be set:

S_IWRITE    If user has permission to write to file.
S_IREAD    If user has permission to read to file.

The HPFS and NTFS file-management systems make the following distinctions:

st_atime    Most recent access
st_mtime    Most recent modify
st_ctime    Creation time

Return Value

fstat and stat return 0 if they successfully retrieved the information about the open file.

On error (failure to get the information) these functions return -1 and set the global variable errno to

EBADF    Bad file handle


blueSea 님이 쓰신 글 :
: 비오는 토요일날.. 회사에서 코딩만 하려니 -.-
: 처량하기 그지 없네요...
:
: 빌더 함수중에
:
: int filehandle;
: AnsiString filename1;
: AnsiString filename2;
:
: filehandle = FileCreate( filename1 );
:
: fileCreate처럼.. 혹시
: 여기서 만들어진 filehandle을 이용해서
: 다시 filename을 알수 있는 방법은 없나요?
:
: filename2 = function( filehandle ); 
:
: 이런함수  없을까요?
:
:
: 꼭 필요하거든요.
: 도움 바랍니다.
:
:

+ -

관련 글 리스트
20735 [질문] handle값을 사용해서 filename을 알수 있는 함수 없나요?ㅠ.ㅠ blueSea 718 2002/08/10
20739     Re:[질문] handle값을 사용해서 filename을 알수 있는 함수 없나요?ㅠ.ㅠ  구 1206 2002/08/10
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.