[問題] 指到File pointer資料?
想請問一下如果要把file pointer的資料存到array去
但是不能用fread之類的只能用memcpy
有辦法嗎@@?
程式如下
File *ptr;
unsigned char *temp;
temp = (unsigned char*)malloc(sizeof(unsigned char)*pic_size);
ptr = fopen("t.bmp", "rb");
memcpy(temp, ptr, pic_size);
free(temp);
fclose(ptr);
上面這樣執行會掛掉
爬文發現似乎是File pointer只代表檔案結構
不知道有沒有辦法抓到檔案內容的位址?
感謝回答
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.113.5.239
※ 編輯: CCAJB 來自: 140.113.5.239 (04/05 18:41)
→
04/05 19:24, , 1F
04/05 19:24, 1F
→
04/05 22:15, , 2F
04/05 22:15, 2F
→
04/06 17:37, , 3F
04/06 17:37, 3F