Click here to Skip to main content
15,919,434 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: FD_ACCEPT event very slow (sometimes) Pin
Moak17-May-07 5:21
Moak17-May-07 5:21 
GeneralRe: FD_ACCEPT event very slow (sometimes) Pin
od@ananzi.co.za22-May-07 4:39
od@ananzi.co.za22-May-07 4:39 
GeneralRe: FD_ACCEPT event very slow (sometimes) Pin
Moak25-May-07 2:53
Moak25-May-07 2:53 
GeneralRe: FD_ACCEPT event very slow (sometimes) Pin
od@ananzi.co.za21-Jun-07 2:42
od@ananzi.co.za21-Jun-07 2:42 
GeneralRe: FD_ACCEPT event very slow (sometimes) Pin
Moak21-Jun-07 6:51
Moak21-Jun-07 6:51 
GeneralRe: FD_ACCEPT event very slow (sometimes) Pin
od@ananzi.co.za21-Jun-07 9:32
od@ananzi.co.za21-Jun-07 9:32 
GeneralRe: FD_ACCEPT event very slow (sometimes) Pin
Moak28-Jun-07 5:39
Moak28-Jun-07 5:39 
Questionreading 'null' from binary files into char arrays/strings Pin
dfn9-May-07 8:02
dfn9-May-07 8:02 
I am having a problem reading binary files.
Basically, everything works fine as long as the byte I read from the binary file is not a 0x00 byte. For example, reading the following (in hex): A0, 30, C0, C0 ... works fine.
But, reading: A0, 34, 03, 00 ... does not work fine.

When I concatenate the strings, instead of sticking "rec" at the end of "data", it concatenates it BEFORE the end of "data" - I assume this is so because one of the bytes I read (00) is treated like '\0' (null). How do I fix this? I have tried using unsigned chars, but that didn't work, I can't use read with them. The string/char array MUST contain everything I read from the binary file (even 0x00), so it can be like "somebyteshere0x00morebyteshere" which is why i need "rec" added to the END of "data", even if "data" contains nulls before its end.

I am using Visual Studio 2005.
A snippet of my code is posted below

string data = "";
char lr[5];
char rec[1028-4];
...
pageFile.read(lr, 4);
lr[4] = '\0'; // terminate string
...
pageFile.read(rec, length-4); // "length" is extracted from "lr"; it is correct, checked many times
rec[length-4] = '\0'; // terminate string
...
data = lr;
data = data + rec; // <----------- problem happens here


Thanks for any help!
AnswerRe: reading 'null' from binary files into char arrays/strings Pin
Chris Losinger9-May-07 8:25
professionalChris Losinger9-May-07 8:25 
GeneralRe: reading 'null' from binary files into char arrays/strings Pin
dfn9-May-07 9:53
dfn9-May-07 9:53 
GeneralRe: reading 'null' from binary files into char arrays/strings Pin
Chris Losinger9-May-07 10:18
professionalChris Losinger9-May-07 10:18 
GeneralRe: reading 'null' from binary files into char arrays/strings Pin
dfn9-May-07 10:41
dfn9-May-07 10:41 
QuestionRe: reading 'null' from binary files into char arrays/strings Pin
David Crow9-May-07 8:27
David Crow9-May-07 8:27 
AnswerRe: reading 'null' from binary files into char arrays/strings Pin
dfn9-May-07 9:54
dfn9-May-07 9:54 
AnswerRe: reading 'null' from binary files into char arrays/strings Pin
GameProfessor9-May-07 15:41
GameProfessor9-May-07 15:41 
GeneralRe: reading 'null' from binary files into char arrays/strings Pin
dfn10-May-07 5:23
dfn10-May-07 5:23 
AnswerRe: reading 'null' from binary files into char arrays/strings Pin
Nelek9-May-07 22:33
protectorNelek9-May-07 22:33 
GeneralRe: reading 'null' from binary files into char arrays/strings Pin
dfn10-May-07 5:22
dfn10-May-07 5:22 
QuestionHow to launch a second application? Pin
IlanTal9-May-07 7:06
IlanTal9-May-07 7:06 
AnswerRe: How to launch a second application? Pin
led mike9-May-07 7:35
led mike9-May-07 7:35 
AnswerRe: How to launch a second application? Pin
Hamid_RT9-May-07 7:39
Hamid_RT9-May-07 7:39 
AnswerRe: How to launch a second application? Pin
David Crow9-May-07 8:10
David Crow9-May-07 8:10 
AnswerRe: How to launch a second application? Pin
SandipG 10-May-07 0:37
SandipG 10-May-07 0:37 
AnswerRe: How to launch a second application? Pin
IlanTal10-May-07 0:52
IlanTal10-May-07 0:52 
AnswerRe: How to launch a second application? Pin
#realJSOP10-May-07 2:06
professional#realJSOP10-May-07 2:06 

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.