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

C / C++ / MFC

 
GeneralRe: How can I read the attributes of files? Pin
ritz123418-Apr-08 4:01
ritz123418-Apr-08 4:01 
GeneralRe: How can I read the attributes of files? Pin
David Crow18-Apr-08 4:06
David Crow18-Apr-08 4:06 
GeneralRe: How can I read the attributes of files? Pin
ritz123418-Apr-08 4:11
ritz123418-Apr-08 4:11 
QuestionRe: How can I read the attributes of files? Pin
David Crow18-Apr-08 4:12
David Crow18-Apr-08 4:12 
GeneralRe: How can I read the attributes of files? Pin
ritz123418-Apr-08 4:19
ritz123418-Apr-08 4:19 
GeneralRe: How can I read the attributes of files? Pin
David Crow18-Apr-08 4:39
David Crow18-Apr-08 4:39 
AnswerRe: How can I read the attributes of files? Pin
Hamid_RT18-Apr-08 20:29
Hamid_RT18-Apr-08 20:29 
GeneralDynamic c++ union or memory map Pin
Member 336349818-Apr-08 2:20
Member 336349818-Apr-08 2:20 
Hi Guys, I have a program that consumes a lot of memory. First of all it dynamically creates an array of char and reads a binary file, as shown below:

---------------

char * memblock; //Pointer to Char array used to read binary file
char unsigned * memcopyblock; //Pointer to char unsigned array used to create int array

ifstream file (fileName, ios::in|ios::binary|ios::ate);

count = file.tellg();
memblock = new char [count];
file.seekg (0, ios::beg); //Set the postion of the pointer to the start of the file
file.read (memblock, count); //Read the 2 minute log file
file.close(); //Close the log file

----------------

it then converts all the 'chars' into 'char unsigned'.

-------------------------------------
memcopyblock = new char unsigned [count];
for (int i=0;i<=count;i++)
memcopyblock[i] = memblock[i]; //copy

delete []memblock;
---------------------------------------------

However, this approach uses twice as much memory as the size of the binary file. Is it possible to read a binary file into a dynamic array of 'char unsigned' or to use a dynamic memory map (i.e. union stucture) to half the amount of memory used by this program?

Cheers,

Aubs
QuestionRe: Dynamic c++ union or memory map Pin
David Crow18-Apr-08 2:56
David Crow18-Apr-08 2:56 
GeneralRe: Dynamic c++ union or memory map Pin
Member 336349818-Apr-08 3:09
Member 336349818-Apr-08 3:09 
GeneralRe: Dynamic c++ union or memory map Pin
CPallini18-Apr-08 3:15
mveCPallini18-Apr-08 3:15 
GeneralDifference between XP and XPe Pin
FPeeters18-Apr-08 1:12
FPeeters18-Apr-08 1:12 
GeneralRe: Difference between XP and XPe Pin
Cedric Moonen18-Apr-08 2:40
Cedric Moonen18-Apr-08 2:40 
GeneralRe: Difference between XP and XPe Pin
FPeeters18-Apr-08 2:56
FPeeters18-Apr-08 2:56 
GeneralRe: Difference between XP and XPe Pin
Cedric Moonen18-Apr-08 3:06
Cedric Moonen18-Apr-08 3:06 
GeneralRe: Difference between XP and XPe Pin
FPeeters18-Apr-08 3:53
FPeeters18-Apr-08 3:53 
GeneralRe: Difference between XP and XPe Pin
David Crow18-Apr-08 4:51
David Crow18-Apr-08 4:51 
GeneralVisual C++ MFC program not on Windows Pin
Kwanalouie18-Apr-08 1:09
Kwanalouie18-Apr-08 1:09 
GeneralRe: Visual C++ MFC program not on Windows Pin
Iain Clarke, Warrior Programmer18-Apr-08 1:15
Iain Clarke, Warrior Programmer18-Apr-08 1:15 
GeneralRe: Visual C++ MFC program not on Windows Pin
Rajesh R Subramanian18-Apr-08 1:18
professionalRajesh R Subramanian18-Apr-08 1:18 
GeneralRe: Visual C++ MFC program not on Windows Pin
Cedric Moonen18-Apr-08 1:21
Cedric Moonen18-Apr-08 1:21 
QuestionRe: Visual C++ MFC program not on Windows Pin
CPallini18-Apr-08 1:30
mveCPallini18-Apr-08 1:30 
GeneralRe: Visual C++ MFC program not on Windows Pin
ThatsAlok18-Apr-08 3:46
ThatsAlok18-Apr-08 3:46 
GeneralRe: Visual C++ MFC program not on Windows Pin
Hamid_RT18-Apr-08 5:34
Hamid_RT18-Apr-08 5:34 
Question[Message Deleted] Pin
C.P.Rajesh18-Apr-08 0:05
C.P.Rajesh18-Apr-08 0:05 

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.