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

C / C++ / MFC

 
GeneralRe: barcode library [edited] Pin
toxcct6-Jul-05 1:09
toxcct6-Jul-05 1:09 
GeneralRe: barcode library Pin
Bob Stanneveld6-Jul-05 1:49
Bob Stanneveld6-Jul-05 1:49 
GeneralCodebar library Pin
a_du5-Jul-05 23:41
a_du5-Jul-05 23:41 
QuestionHow to create a localised MFC resources DLL? Pin
Kri55-Jul-05 22:44
Kri55-Jul-05 22:44 
AnswerRe: How to create a localised MFC resources DLL? Pin
Kri55-Jul-05 23:38
Kri55-Jul-05 23:38 
GeneralRe: How to create a localised MFC resources DLL? Pin
Blake V. Miller7-Jul-05 16:50
Blake V. Miller7-Jul-05 16:50 
GeneralRe: How to create a localised MFC resources DLL? Pin
ParagPatel18-Nov-09 22:59
ParagPatel18-Nov-09 22:59 
Generalstd::ifstream trouble Pin
Bob Stanneveld5-Jul-05 22:29
Bob Stanneveld5-Jul-05 22:29 
Hello,

I once again have problems with the file iostreams from the STL provided with visual studio (2005).

I use the std::ofstream to write data to a file. I verified all the data and everything here works like a charm. The problem here is when I try to read the data back from the file using the std::ifstream class. It reads more bytes than I say it should read. Take a look at my code:

void ReadData(std::ifstream& InFile, char* pData, size_t nCount)
{
	assert( pData );
	assert( nCount > 0 );

	int nPos = InFile.tellg();

	try
	{
		for( size_t i = 0; i < nCount; i++ )
		        (*(pData + i)) = InFile.get();

                // I also tried using:
                // InFile.read(pData, nCount); 
                // but this gives the same error...
	}
	catch( std::exception& ex )
	{
		InFile.seekg(nPos);
	}
}


I removed all the debug code and output statements. My scenario is as follows:
- I have a binary file,
- I read (nCount = 410) bytes
- The stream reads 499 bytes Confused | :confused:

I really don't know what might be wrong here.

Behind every great black man...
            ... is the police. - Conspiracy brother


Blog[^]
GeneralDoh! Pin
Bob Stanneveld5-Jul-05 23:08
Bob Stanneveld5-Jul-05 23:08 
GeneralRebar resizing Pin
__makaveli__5-Jul-05 22:12
__makaveli__5-Jul-05 22:12 
Generaldirectshow Pin
URtruefriendalways5-Jul-05 22:03
sussURtruefriendalways5-Jul-05 22:03 
GeneralMDI Parent Size Problem Pin
yccheok5-Jul-05 21:51
yccheok5-Jul-05 21:51 
GeneralRe: MDI Parent Size Problem Pin
sayup5-Jul-05 22:19
sayup5-Jul-05 22:19 
GeneralRe: MDI Parent Size Problem Pin
David Crow6-Jul-05 2:41
David Crow6-Jul-05 2:41 
GeneralRe: MDI Parent Size Problem Pin
sayup6-Jul-05 5:07
sayup6-Jul-05 5:07 
GeneralRe: MDI Parent Size Problem Pin
David Crow6-Jul-05 5:56
David Crow6-Jul-05 5:56 
GeneralSimultaneous access to a serial device from two threads Pin
Juergen Kordes5-Jul-05 21:30
Juergen Kordes5-Jul-05 21:30 
GeneralRe: Simultaneous access to a serial device from two threads Pin
ThatsAlok5-Jul-05 21:42
ThatsAlok5-Jul-05 21:42 
Generalwindow media player Pin
Anonymous5-Jul-05 21:17
Anonymous5-Jul-05 21:17 
GeneralRe: window media player Pin
Jose Lamas Rios6-Jul-05 3:39
Jose Lamas Rios6-Jul-05 3:39 
Generalip adress Pin
_tasleem5-Jul-05 20:57
_tasleem5-Jul-05 20:57 
GeneralRe: ip adress Pin
ThatsAlok5-Jul-05 21:35
ThatsAlok5-Jul-05 21:35 
GeneralFont Problem Pin
Pazzuzu5-Jul-05 20:46
Pazzuzu5-Jul-05 20:46 
QuestionTo delete functions via IDE of VC++ 2003 ? Pin
Maxwell Chen5-Jul-05 20:45
Maxwell Chen5-Jul-05 20:45 
Generalopening MDI in maximized form at startup Pin
sayup5-Jul-05 20:15
sayup5-Jul-05 20:15 

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.