Click here to Skip to main content
15,889,724 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Need some constants/defines from winspool.h Pin
Russell'3-Sep-07 0:32
Russell'3-Sep-07 0:32 
GeneralRe: Need some constants/defines from winspool.h Pin
Ralf Lohmueller3-Sep-07 2:32
Ralf Lohmueller3-Sep-07 2:32 
GeneralRe: Need some constants/defines from winspool.h Pin
Russell'3-Sep-07 2:46
Russell'3-Sep-07 2:46 
AnswerSolved: new Vista constants/defines from winspool.h Pin
Ralf Lohmueller5-Sep-07 14:31
Ralf Lohmueller5-Sep-07 14:31 
QuestionCString porble Pin
m1m22-Sep-07 9:18
m1m22-Sep-07 9:18 
QuestionRe: CString porble Pin
Mark Salsbery2-Sep-07 9:39
Mark Salsbery2-Sep-07 9:39 
AnswerRe: CString porble Pin
m1m22-Sep-07 10:37
m1m22-Sep-07 10:37 
AnswerRe: CString porble Pin
Jason Teagle2-Sep-07 22:58
Jason Teagle2-Sep-07 22:58 
One possible reason that springs to mind is that the file somehow contains an embedded null. If this is true, strTemp probably *is* being added, but the embedded null stops the variable watch window from displaying the entire string. Also, if you try and use string manipulation routines on m_strFileBuffer, they will be affected by this null equally, and terminate the string early.

To test if this is the problem, try modifying your code to this:

CString strTemp;
const int MAX_LINE_LENGTH_EXPECTED = 1024 ;
TCHAR cBuffer[MAX_LINE_LENGTH_EXPECTED + 1];
while( ar.ReadString(cBuffer, MAX_LINE_LENGTH_EXPECTED) != NULL)
{
if (cBuffer[_tcslen(cBuffer) - 1] != _T('\r')
&& cBuffer[_tcslen(cBuffer) - 1] != _T('\n') )
{
// We may have a prematurely-truncated string.
// Or it will be the end of the file {:v)
assert(false); <=== put breakpoint on this line.
}

m_strFileBuffer += strTemp + _T(" ");
}


If there's an embedded null, the character found at where it believes the end of the string is will *not* be the <cr> / <lf> it should be. Obviously the genuine end of the file may also not end with CR / LF, so be prepared for that.

If you think your file might contain lines longer than 1024, adjust MAX_LINE_LENGTH_EXPECTED as appropriate.
QuestionHyperlink on WebBrowser Control Pin
vikrant kpr2-Sep-07 8:23
vikrant kpr2-Sep-07 8:23 
AnswerRe: Hyperlink on WebBrowser Control Pin
Gary R. Wheeler2-Sep-07 14:25
Gary R. Wheeler2-Sep-07 14:25 
QuestionUnicode string hash Pin
Bartosz Bien2-Sep-07 6:52
Bartosz Bien2-Sep-07 6:52 
AnswerRe: Unicode string hash Pin
cmk2-Sep-07 7:55
cmk2-Sep-07 7:55 
Questioncurve length Pin
includeh102-Sep-07 6:14
includeh102-Sep-07 6:14 
AnswerRe: curve length Pin
Anurag Gandhi2-Sep-07 20:32
professionalAnurag Gandhi2-Sep-07 20:32 
AnswerRe: curve length Pin
Russell'3-Sep-07 1:16
Russell'3-Sep-07 1:16 
Questioncan you help me with a program that can do numerical methods? Pin
mitsui582-Sep-07 2:26
mitsui582-Sep-07 2:26 
AnswerRe: can you help me with a program that can do numerical methods? [modified] Pin
mitsui583-Sep-07 1:30
mitsui583-Sep-07 1:30 
QuestionCBitmapButton mouseover change bitmap? (vc++ 6.0) Pin
rolfhorror2-Sep-07 2:05
rolfhorror2-Sep-07 2:05 
AnswerRe: CBitmapButton mouseover change bitmap? (vc++ 6.0) Pin
Mark Salsbery2-Sep-07 9:50
Mark Salsbery2-Sep-07 9:50 
GeneralRe: CBitmapButton mouseover change bitmap? (vc++ 6.0) Pin
rolfhorror2-Sep-07 10:35
rolfhorror2-Sep-07 10:35 
QuestionI have a question about retrieve a window handle at mouse position. Pin
tmay_992-Sep-07 0:32
tmay_992-Sep-07 0:32 
AnswerRe: I have a question about retrieve a window handle at mouse position. Pin
bob169722-Sep-07 5:00
bob169722-Sep-07 5:00 
GeneralRe: I have a question about retrieve a window handle at mouse position. Pin
tmay_992-Sep-07 11:21
tmay_992-Sep-07 11:21 
GeneralRe: I have a question about retrieve a window handle at mouse position. Pin
bob169722-Sep-07 13:37
bob169722-Sep-07 13:37 
GeneralRe: I have a question about retrieve a window handle at mouse position. Pin
bob169722-Sep-07 13:41
bob169722-Sep-07 13:41 

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.