구조체포인터 질문
로와
global.h
..
struct direntry {
chardeName[8]; // filename, blank filled
#define SLOT_EMPTY 0x00// slot has never been used
#define SLOT_E5 0x05// the real value is 0xe5
#define SLOT_DELETED 0xe5// file in this slot deleted
unsigned chardeExtension[3]; // extension, blank filled
unsigned chardeAttributes; // file attributes
#define ATTR_NORMAL 0x00// normal file
#define ATTR_READONLY 0x01// file is readonly
#define ATTR_HIDDEN 0x02// file is hidden
#define ATTR_SYSTEM 0x04// file is a system file
#define ATTR_VOLUME 0x08// entry is a volume label
#define ATTR_LONG_FILENAME0x0f// this is a long filename entry
#define ATTR_DIRECTORY 0x10// entry is a directory name
#define ATTR_ARCHIVE 0x20// file is new or modified
unsigned chardeLowerCase; // NT VFAT lower case flags
#define LCASE_BASE 0x08// filename base in lower case
#define LCASE_EXT 0x10// filename extension in lower case
unsigned chardeCHundredth;// hundredth of seconds in CTime
unsigned chardeCTime[2];// create time
unsigned chardeCDate[2];// create date
unsigned chardeADate[2];// access date
unsigned int deHighClust;// high bytes of cluster number
unsigned chardeMTime[2];// last update time
unsigned chardeMDate[2];// last update date
unsigned int deStartCluster;// starting cluster of file
unsigned longdeFileSize;// size of file in bytes
};
..
main.c
..
..
unsigned char fatGetDirEntry(unsigned long cluster)
{
unsigned char count_file = 0; // 파일의 총 개수
unsigned long offset=0;
struct direntry *de = 0; // avoid compiler warning by initializing
int index;
unsigned int clus_hi, clus_lo;
unsigned long cluster_number;
for (offset=0; ; offset++)
{
de = (struct direntry *) fatDir(cluster, offset);
if (de == NULL)
return count_file;
for (index=0; index16; index++) // 16 direntries
{
if (*de-deName == SLOT_EMPTY) //slot_empty이거는 헥사파일임
return count_file; // there is no more direntries
if((*de-deName != SLOT_DELETED) && (de-deAttributes != ATTR_LONG_FILENAME))
{
clus_hi = de-deHighClust;
clus_lo = de-deStartCluster;
cluster_number = (unsigned long)(clus_hi);
cluster_number = 16;
cluster_number |= (unsigned long)(clus_lo);
fatFileStartClust[count_file++] = cluster_number;
}
de++;
}// end of sector
}// end of cluster
return count_file;
}
여기서 direntry라는 곳에서 *de-deName 라고 해서 == SLOT_EMPTY라고 비교하고 있고 밑에 줄에는 de-deAttributes 해서
같은지 다른지 비교하고 있는데 *de 랑 de 에서 이거 뭐가 다른가요... 구조체에서.... 뭐가 좀 이상하다 싶어 올려봅니다.
-
내꺼
일종의 뭐랄까 만든사람이 그렇게 쓰게 만들어 놓은 것이죠..ㅎㅎ
번호 | 제 목 | 글쓴이 | 날짜 |
---|---|---|---|
2700562 | 함수포인터에서요 (7) | 소심한여자 | 2025-07-06 |
2700530 | 전처리문 질문입니다. (1) | 아놀드 | 2025-07-05 |
2700510 | c언어를 어케하면 잘할수 있을까요.. | 연연두 | 2025-07-05 |
2700484 | 두 개가 차이가 뭔지 알려주세요...(소수 찾는 프로그램) (2) | 날위해 | 2025-07-05 |
2700426 | 인터넷 창 띄우는 질문이요 (1) | 정훈 | 2025-07-04 |
2700400 | 원넓이를 계산이요 ㅜㅜ | 천칭자리 | 2025-07-04 |
2700368 | if에 관해서 질문이요... | Orange | 2025-07-04 |
2700339 | 이거 결과값이 왜이런건지.. (4) | 그댸와나 | 2025-07-04 |
2700313 | 파일 읽어서 저장하는데 빈파일일 경우 문재가 발생하네요.. (2) | 크나 | 2025-07-03 |
2700287 | 구조체 동적할당 연습을 하는데 오류가 뜹니다...(해결) (3) | 아련나래 | 2025-07-03 |
2700264 | 문자와 숫자 동시에 입력??? | 글고운 | 2025-07-03 |
2700236 | txt파일로만 쓰고 읽게 하려면 어떻게 해야 하나요..?? (8) | 미국녀 | 2025-07-03 |
2700211 | 전위 연산자 (2) | 어른처럼 | 2025-07-02 |
2700183 | C에서 파일이름을 받고, 그 파일의 사이즈를 출력해줘야하는데 내용이 출력이 안되네요 ;ㅅ; | 피스케스 | 2025-07-02 |
2700150 | 꼭좀 도와주세요ㅠㅠㅠ | 호습다 | 2025-07-02 |
2700095 | 연산문제...질문... | 오빤테앵겨 | 2025-07-01 |
2700070 | while문 , 3의배수 출력하는 프로그램좀 짜주세욤. | 횃불 | 2025-07-01 |
2700041 | 초보인데요 ㅎ 배열안에 배열을 집어넣을수 있나요?? | 헛장사 | 2025-07-01 |
2700012 | 배열// (1) | 전갈자리 | 2025-07-01 |
2699895 | 무한루프에 빠집니다.!! 해결좀부탁드려요 (10) | 선아 | 2025-06-30 |