Click here to Skip to main content
12,070,351 members (58,103 online)

C / C++ / MFC

 
GeneralRe: Which among following statements c/c++ code is faster? Pin
shaktikanta25-Mar-14 4:18
membershaktikanta25-Mar-14 4:18 
GeneralRe: Which among following statements c/c++ code is faster? Pin
Maximilien25-Mar-14 4:32
memberMaximilien25-Mar-14 4:32 
GeneralRe: Which among following statements c/c++ code is faster? Pin
jschell25-Mar-14 14:26
memberjschell25-Mar-14 14:26 
JokeRe: Which among following statements c/c++ code is faster? Pin
Rage25-Mar-14 3:20
professionalRage25-Mar-14 3:20 
AnswerRe: Which among following statements c/c++ code is faster? Pin
Albert Holguin25-Mar-14 5:42
professionalAlbert Holguin25-Mar-14 5:42 
AnswerRe: Which among following statements c/c++ code is faster? Pin
ptse26-Mar-14 4:34
memberptse26-Mar-14 4:34 
GeneralRe: Which among following statements c/c++ code is faster? Pin
Richard MacCutchan26-Mar-14 6:24
protectorRichard MacCutchan26-Mar-14 6:24 
QuestionFree fails with access violation Pin
tejaswini_g24-Mar-14 17:14
membertejaswini_g24-Mar-14 17:14 
Reposting as thread has grown

#include <<windows.h>> // remove extra angle bracket for compilation
#include <<tchar.h>>
#include <<stdio.h>>
#include <<strsafe.h>>

void FreeMemory(char** myArray, int row);
void FileCountInDir(const TCHAR* dirpath, int * filescount, int* filesize);
void FindFilesInDirectory(const TCHAR* dirpath, char** filelist);

int _tmain(int argc, TCHAR *argv[])
{
int i =0;
TCHAR szDirpath[MAX_PATH];
//TCHAR Filelist[100][MAX_PATH];
char ** Filelist;
int iFileCountInFolder=0;
int iFileSize = 0;

_tcscpy(szDirpath,_T("C:\\BMPread_W\\TransitionEffects\\Images"));

FileCountInDir(szDirpath,&iFileCountInFolder,&iFileSize);
Filelist = (char**)malloc(iFileCountInFolder * sizeof(char *));
if(Filelist == NULL)
{
fprintf(stderr, "out of memory\n");
return 0;
}
for(i = 0; i < iFileCountInFolder; i++)
{
Filelist[i] = (char*)malloc((iFileSize * sizeof(char))+1);
if(Filelist[i] == NULL)
{
fprintf(stderr, "out of memory\n");
return 0;
}
}
FindFilesInDirectory(szDirpath, Filelist);

for(i =0;i 0)|| ((*filesize) < _tcslen(ffd.cFileName)))
{
(*filesize) = _tcslen(ffd.cFileName);
}
}
}
while (FindNextFile(hFind, &ffd) != 0);
FindClose(hFind);
}

void FreeMemory(char** myArray, int row)
{
int i;
if(myArray != NULL)
{
for (i = 0; i < row; i++){
free (myArray[i]); 

}
}
AnswerRe: Free fails with access violation Pin
Richard MacCutchan24-Mar-14 23:52
protectorRichard MacCutchan24-Mar-14 23:52 
AnswerRe: Free fails with access violation Pin
Richard Andrew x6425-Mar-14 6:59
professionalRichard Andrew x6425-Mar-14 6:59 
AnswerRe: Free fails with access violation Pin
leon de boer25-Mar-14 18:36
memberleon de boer25-Mar-14 18:36 
AnswerRe: Free fails with access violation Pin
pwasser25-Mar-14 21:13
memberpwasser25-Mar-14 21:13 
GeneralDirectShow GraphEdit missing property page options tab. PARTIALLY SOLVED - CLOSED Pin
Vaclav_Sal24-Mar-14 16:42
memberVaclav_Sal24-Mar-14 16:42 
GeneralRe: DirectShow GraphEdit missing property page options tab. Pin
Rage25-Mar-14 3:19
professionalRage25-Mar-14 3:19 
Generalx it.Re: DirectShow GraphEdit missing property page options tab.IN PROGRESS Pin
Vaclav_Sal25-Mar-14 8:29
memberVaclav_Sal25-Mar-14 8:29 
QuestionFree fails with Access violation reading location Pin
tejaswini_g24-Mar-14 14:31
membertejaswini_g24-Mar-14 14:31 
AnswerRe: Free fails with Access violation reading location Pin
Richard Andrew x6424-Mar-14 14:42
professionalRichard Andrew x6424-Mar-14 14:42 
GeneralRe: Free fails with Access violation reading location Pin
tejaswini_g24-Mar-14 16:01
membertejaswini_g24-Mar-14 16:01 
AnswerRe: Free fails with Access violation reading location Pin
leon de boer24-Mar-14 16:06
memberleon de boer24-Mar-14 16:06 
GeneralRe: Free fails with Access violation reading location Pin
pwasser24-Mar-14 16:25
memberpwasser24-Mar-14 16:25 
GeneralRe: Free fails with Access violation reading location Pin
pwasser24-Mar-14 16:59
memberpwasser24-Mar-14 16:59 
QuestionRe: Free fails with Access violation reading location Pin
pwasser24-Mar-14 16:17
memberpwasser24-Mar-14 16:17 
AnswerRe: Free fails with Access violation reading location Pin
tejaswini_g24-Mar-14 16:39
membertejaswini_g24-Mar-14 16:39 
AnswerRe: Free fails with Access violation reading location Pin
pwasser24-Mar-14 17:01
memberpwasser24-Mar-14 17:01 
GeneralRe: Free fails with Access violation reading location Pin
tejaswini_g24-Mar-14 17:11
membertejaswini_g24-Mar-14 17:11 

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.


Advertise | Privacy | Mobile
Web04 | 2.8.160208.1 | Last Updated 9 Feb 2016
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid