Click here to Skip to main content
15,920,896 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Activex control in linux Pin
CPallini11-Jan-11 2:49
mveCPallini11-Jan-11 2:49 
GeneralRe: Activex control in linux Pin
Sakhalean11-Jan-11 3:01
Sakhalean11-Jan-11 3:01 
AnswerRe: Activex control in linux Pin
Cool_Dev11-Jan-11 2:50
Cool_Dev11-Jan-11 2:50 
QuestionListing Unused Variables Pin
softwaremonkey11-Jan-11 2:31
softwaremonkey11-Jan-11 2:31 
AnswerRe: Listing Unused Variables Pin
Maximilien11-Jan-11 2:41
Maximilien11-Jan-11 2:41 
GeneralRe: Listing Unused Variables Pin
Luc Pattyn11-Jan-11 3:12
sitebuilderLuc Pattyn11-Jan-11 3:12 
GeneralRe: Listing Unused Variables Pin
Maximilien11-Jan-11 6:34
Maximilien11-Jan-11 6:34 
GeneralRe: Listing Unused Variables Pin
Luc Pattyn11-Jan-11 6:46
sitebuilderLuc Pattyn11-Jan-11 6:46 
AnswerRe: Listing Unused Variables Pin
Cool_Dev11-Jan-11 2:47
Cool_Dev11-Jan-11 2:47 
GeneralRe: Listing Unused Variables Pin
softwaremonkey11-Jan-11 3:04
softwaremonkey11-Jan-11 3:04 
AnswerRe: Listing Unused Variables Pin
Yusuf11-Jan-11 3:31
Yusuf11-Jan-11 3:31 
QuestionCustom member variable Pin
mesajflaviu11-Jan-11 0:22
mesajflaviu11-Jan-11 0:22 
AnswerRe: Custom member variable Pin
CPallini11-Jan-11 0:26
mveCPallini11-Jan-11 0:26 
JokeRe: Custom member variable Pin
bleedingfingers11-Jan-11 0:58
bleedingfingers11-Jan-11 0:58 
GeneralRe: Custom member variable [modified] Pin
mesajflaviu11-Jan-11 1:39
mesajflaviu11-Jan-11 1:39 
GeneralRe: Custom member variable Pin
mesajflaviu12-Jan-11 4:56
mesajflaviu12-Jan-11 4:56 
QuestionImage Transparency saving but Not showing. Pin
002comp10-Jan-11 20:37
002comp10-Jan-11 20:37 
AnswerRe: Image Transparency saving but Not showing. Pin
jk chan11-Jan-11 0:46
jk chan11-Jan-11 0:46 
GeneralRe: Image Transparency saving but Not showing. Pin
002comp11-Jan-11 1:01
002comp11-Jan-11 1:01 
Question_fstat() without File Descriptor Pin
gomathylakshmanan10-Jan-11 19:49
gomathylakshmanan10-Jan-11 19:49 
AnswerRe: _fstat() without File Descriptor Pin
Andrew Brock10-Jan-11 20:07
Andrew Brock10-Jan-11 20:07 
QuestionRe: _fstat() without File Descriptor Pin
Andrew Brock10-Jan-11 23:31
Andrew Brock10-Jan-11 23:31 
Sorry, I found your earlier question in which you said it was an ifstream that you were using.
From what I can see there is no way of getting anything useful toward a file handle out of the ifstream, short of making a hack for it.
I would recommend using functions like CreateFile and GetFileSize using handles or just opening the file a second time with _open(name, _O_RDONLY, _SH_DENYNO) depending on what information you are wanting.

If you really really want to stick with ifstream, then this is a hack that will get the file descriptor out for the version I have. It may be different than your version due to hotfixes.
//Get the FileBuffer out of the ifstream
ifstream::_Myfb *pFileBuffer =  infile.rdbuf(); 
//Convert that to a series of bytes
char *pFileBufferMemory = (char *)(void *)pFileBuffer;
//the FILE * is the last member in the _Myfb class, seek to the end of the memory and step back sizeof(FILE *)
FILE **pFilePtrPtr = (FILE **)(pFileBufferMemory + sizeof(ifstream::_Myfb) - sizeof(FILE *));
//dereferance the memory pointer
FILE *pFilePtr = *pFilePtrPtr; 
//get the file descriptor from the FILE *. Equivelent to pFilePtr->_file;
int nFileDescriptor = _fileno(pFilePtr); 

//do the above in 1 line of code
int nFileDescriptor2 = _fileno(*(FILE **)(((char *)(void *)infile.rdbuf()) + sizeof(ifstream::_Myfb) - sizeof(FILE *)));

QuestionGetting ERROR_INSUFFICIENT_BUFFER error in DeviceIoControl Function Pin
learningvisualc10-Jan-11 18:49
learningvisualc10-Jan-11 18:49 
AnswerRe: Getting ERROR_INSUFFICIENT_BUFFER error in DeviceIoControl Function Pin
Andrew Brock10-Jan-11 19:57
Andrew Brock10-Jan-11 19:57 
QuestionFont in CWnd Pin
includeh1010-Jan-11 17:31
includeh1010-Jan-11 17:31 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.