Click here to Skip to main content
15,923,374 members
Home / Discussions / Mobile
   

Mobile

 
GeneralRe: INI Files -Read/WritePrivateProfilestring Pin
Atlantys17-Oct-03 13:26
Atlantys17-Oct-03 13:26 
GeneralRe: INI Files -Read/WritePrivateProfilestring Pin
#realJSOP18-Oct-03 0:32
professional#realJSOP18-Oct-03 0:32 
GeneralCrash Pin
gregs17-Oct-03 2:48
gregs17-Oct-03 2:48 
Generalunresolved external _Lockit Pin
BadJerry17-Oct-03 2:30
BadJerry17-Oct-03 2:30 
GeneralProblem "Solved" Pin
BadJerry17-Oct-03 9:18
BadJerry17-Oct-03 9:18 
Generalfree a char[ ] Pin
slomoman15-Oct-03 6:38
slomoman15-Oct-03 6:38 
GeneralRe: free a char[ ] Pin
Atlantys15-Oct-03 10:45
Atlantys15-Oct-03 10:45 
GeneralRe: free a char[ ] Pin
Jonas Larsson15-Oct-03 23:01
Jonas Larsson15-Oct-03 23:01 
Why use a char*/wchar_t* at all?

I'd do it this way (error handling removed):
std::vector< char > data; // file is ASCII, use wchar_t here otherwise
HANDLE h = CreateFile(filename , GENERIC_READ, 0, 0, OPEN_EXISTING, 0, 0);
DWORD fs = GetFileSize(h, 0);
data.resize(fs / sizeof(char) ); // file is ASCII, use wchar_t here otherwise
DWORD read = 0;
ReadFile(h, data.begin(), fs, &read, 0); // &data[0] is perhaps more safe iso .begin()
CloseHandle(h);
ASSERT(read == fs);
data.push_back(0);
//


slomoman wrote:
does anybody see any memory-leaks?
I see no memoryleaks in the code you posted.


“Our solar system is Jupiter and a bunch of junk” - Charley Lineweaver 2002
GeneralRe: free a char[ ] Pin
slomoman16-Oct-03 0:00
slomoman16-Oct-03 0:00 
GeneralRe: free a char[ ] Pin
Jonas Larsson16-Oct-03 1:02
Jonas Larsson16-Oct-03 1:02 
GeneralRe: free a char[ ] Pin
Jonas Larsson16-Oct-03 1:28
Jonas Larsson16-Oct-03 1:28 
GeneralDetecting Power Off Pin
Atlantys14-Oct-03 12:47
Atlantys14-Oct-03 12:47 
GeneralRe: Detecting Power Off Pin
João Paulo Figueira14-Oct-03 23:03
professionalJoão Paulo Figueira14-Oct-03 23:03 
GeneralRe: Detecting Power Off Pin
Atlantys15-Oct-03 6:04
Atlantys15-Oct-03 6:04 
QuestionHow to get the redirected URL or Curent URL from the HTML Viwer/Container Pin
AKSIVAKUMAR14-Oct-03 5:41
AKSIVAKUMAR14-Oct-03 5:41 
AnswerRe: How to get the redirected URL or Curent URL from the HTML Viwer/Container Pin
João Paulo Figueira14-Oct-03 6:38
professionalJoão Paulo Figueira14-Oct-03 6:38 
Generalexport dialog-recource Pin
slomoman13-Oct-03 7:56
slomoman13-Oct-03 7:56 
GeneralRe: export dialog-recource Pin
João Paulo Figueira13-Oct-03 11:06
professionalJoão Paulo Figueira13-Oct-03 11:06 
Generaljpgs in pocketIE look crappy Pin
slomoman13-Oct-03 7:42
slomoman13-Oct-03 7:42 
Generalclose the MainFrame from a Child-Window Pin
slomoman13-Oct-03 7:34
slomoman13-Oct-03 7:34 
GeneralRe: close the MainFrame from a Child-Window Pin
João Paulo Figueira13-Oct-03 10:46
professionalJoão Paulo Figueira13-Oct-03 10:46 
GeneralRe: close the MainFrame from a Child-Window Pin
slomoman15-Oct-03 3:13
slomoman15-Oct-03 3:13 
GeneralRe: close the MainFrame from a Child-Window Pin
João Paulo Figueira15-Oct-03 3:24
professionalJoão Paulo Figueira15-Oct-03 3:24 
GeneralRe: close the MainFrame from a Child-Window Pin
slomoman15-Oct-03 5:37
slomoman15-Oct-03 5:37 
GeneralOn Wakup: Determine if Password and/or User Information Dialog ist closed... Pin
User-37793613-Oct-03 6:56
User-37793613-Oct-03 6:56 

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.