Click here to Skip to main content
15,922,166 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How to run MFC application Pin
Toni7823-Apr-03 10:10
Toni7823-Apr-03 10:10 
AnswerRe: How to run MFC application Pin
David Crow23-Apr-03 10:16
David Crow23-Apr-03 10:16 
AnswerRe: How to run MFC application Pin
Joan M23-Apr-03 21:34
professionalJoan M23-Apr-03 21:34 
GeneralDelete Scrollbar Pin
gmlnd23-Apr-03 9:38
gmlnd23-Apr-03 9:38 
GeneralRe: Delete Scrollbar Pin
Chris Losinger23-Apr-03 10:39
professionalChris Losinger23-Apr-03 10:39 
GeneralUGH! widechar buffer problem Pin
will138323-Apr-03 9:18
will138323-Apr-03 9:18 
GeneralRe: UGH! widechar buffer problem Pin
Tim Smith23-Apr-03 10:07
Tim Smith23-Apr-03 10:07 
GeneralRe: UGH! widechar buffer problem Pin
will138323-Apr-03 10:34
will138323-Apr-03 10:34 
Yes that is true. I found a really weird case though.

As it turns out, the FILE stream buffer is allocated in 4k segments. When you do an fread, the fread checks the size left in the buffer and puts as much as it can into that buffer and sets a flag saying the buffer is full. At that point a new buffer is allocated and fread continues along it's merry way.

In my case I'm using fgetwc, which gets 2 characters (4 bytes). It checks to see if there is enough space in the buffer for the 2 characters, and if so puts it in. If there is not enough space (meaning there is only 2 bytes left in the buffer), it returns 2 chars worth of jargen, causing the application to bomb.

Becuase it only occurs when there I am calling fgetwc and there is only 2 bytes left in the buffer, I am rarely seeing this case but am able to easily reproduce the problem.

My solution, to not use fputwc and fgetwc anymore, but to use fwrite and fread.

You can find this in the _FGETWC.C that came with VC++ 6.0
GeneralI give up on GDI ! Pin
pankajdaga23-Apr-03 9:08
pankajdaga23-Apr-03 9:08 
GeneralRe: I give up on GDI ! Pin
Chris Richardson23-Apr-03 9:19
Chris Richardson23-Apr-03 9:19 
GeneralRe: I give up on GDI ! Pin
pankajdaga23-Apr-03 9:38
pankajdaga23-Apr-03 9:38 
GeneralRe: I give up on GDI ! Pin
Joel Lucsy23-Apr-03 13:27
Joel Lucsy23-Apr-03 13:27 
GeneralRe: I give up on GDI ! Pin
basementman24-Apr-03 7:12
basementman24-Apr-03 7:12 
QuestionHow to restore previous CTreeCtrl state after app. exit Pin
Jingmin Wei23-Apr-03 8:18
Jingmin Wei23-Apr-03 8:18 
AnswerRe: How to restore previous CTreeCtrl state after app. exit Pin
brianwelsch23-Apr-03 18:46
brianwelsch23-Apr-03 18:46 
GeneralThank you so much! Pin
Jingmin Wei24-Apr-03 7:06
Jingmin Wei24-Apr-03 7:06 
GeneralMemory Size Pin
emrosa23-Apr-03 7:42
emrosa23-Apr-03 7:42 
GeneralRe: Memory Size Pin
Chris Meech23-Apr-03 8:34
Chris Meech23-Apr-03 8:34 
GeneralRe: Memory Size Pin
David Crow23-Apr-03 10:28
David Crow23-Apr-03 10:28 
GeneralRe: Memory Size Pin
Nitron23-Apr-03 14:07
Nitron23-Apr-03 14:07 
GeneralMFC support for applications Pin
Antti Keskinen23-Apr-03 7:25
Antti Keskinen23-Apr-03 7:25 
GeneralRe: MFC support for applications Pin
Nitron23-Apr-03 14:08
Nitron23-Apr-03 14:08 
GeneralLimiting the number of instances Pin
CDRom23-Apr-03 7:02
CDRom23-Apr-03 7:02 
GeneralRe: Limiting the number of instances Pin
David Crow23-Apr-03 7:40
David Crow23-Apr-03 7:40 
GeneralBasic printing Pin
act_x23-Apr-03 6:28
act_x23-Apr-03 6:28 

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.