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

C / C++ / MFC

 
JokeRe: Which among following statements c/c++ code is faster? Pin
Rage25-Mar-14 2:20
professionalRage25-Mar-14 2:20 
AnswerRe: Which among following statements c/c++ code is faster? Pin
Albert Holguin25-Mar-14 4:42
professionalAlbert Holguin25-Mar-14 4:42 
AnswerRe: Which among following statements c/c++ code is faster? Pin
ptse26-Mar-14 3:34
ptse26-Mar-14 3:34 
GeneralRe: Which among following statements c/c++ code is faster? Pin
Richard MacCutchan26-Mar-14 5:24
mveRichard MacCutchan26-Mar-14 5:24 
QuestionFree fails with access violation Pin
tejaswini_g24-Mar-14 16:14
tejaswini_g24-Mar-14 16:14 
AnswerRe: Free fails with access violation Pin
Richard MacCutchan24-Mar-14 22:52
mveRichard MacCutchan24-Mar-14 22:52 
AnswerRe: Free fails with access violation Pin
Richard Andrew x6425-Mar-14 5:59
professionalRichard Andrew x6425-Mar-14 5:59 
AnswerRe: Free fails with access violation Pin
leon de boer25-Mar-14 17:36
leon de boer25-Mar-14 17:36 
Okay that rubbish won't even compile

No compiler is going to let this line thru
for(i =0;i 0)|| ((*filesize) < _tcslen(ffd.cFileName)))

I am also suggesting that this line was also supposed to be that function defined but it has ";" rather than open brackets
FindFilesInDirectory(szDirpath, Filelist);

The other function is not provided anywhere
void FileCountInDir(const TCHAR* dirpath, int * filescount, int* filesize);


Can I suggest you give us some code that actually compiles if you want help

There is also some house cleaning you didn't release the pointer array in FreeMemory. To make you life easier can I suggest you make a CreateMemory function to add to your FreeMemory function here is what they look like
C#
char** CreateMemory(int rows, int stringsize) {
    int i;
    char** p;

    p = (char**) malloc (rows * sizeof (char*));
    if(p != NULL){
        for (i = 0; i < rows; i++){
            p[i] = (char*) malloc(stringsize * sizeof(char));
        }
    };
    return (p);
};

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

This is how you use them
C#
char** q;

q = CreateMemory(10, 256);  // create 10 rows each 256 chars
strcpy(q[0], "row 1\0");  // fill row 1
strcpy(q[9], "row 10\0");  // fill row 10
FreeMemory(q, 10); // release all the memory

AnswerRe: Free fails with access violation Pin
User 5924125-Mar-14 20:13
User 5924125-Mar-14 20:13 
GeneralDirectShow GraphEdit missing property page options tab. PARTIALLY SOLVED - CLOSED Pin
Vaclav_24-Mar-14 15:42
Vaclav_24-Mar-14 15:42 
GeneralRe: DirectShow GraphEdit missing property page options tab. Pin
Rage25-Mar-14 2:19
professionalRage25-Mar-14 2:19 
Generalx it.Re: DirectShow GraphEdit missing property page options tab.IN PROGRESS Pin
Vaclav_25-Mar-14 7:29
Vaclav_25-Mar-14 7:29 
QuestionFree fails with Access violation reading location Pin
tejaswini_g24-Mar-14 13:31
tejaswini_g24-Mar-14 13:31 
AnswerRe: Free fails with Access violation reading location Pin
Richard Andrew x6424-Mar-14 13:42
professionalRichard Andrew x6424-Mar-14 13:42 
GeneralRe: Free fails with Access violation reading location Pin
tejaswini_g24-Mar-14 15:01
tejaswini_g24-Mar-14 15:01 
AnswerRe: Free fails with Access violation reading location Pin
leon de boer24-Mar-14 15:06
leon de boer24-Mar-14 15:06 
GeneralRe: Free fails with Access violation reading location Pin
User 5924124-Mar-14 15:25
User 5924124-Mar-14 15:25 
GeneralRe: Free fails with Access violation reading location Pin
User 5924124-Mar-14 15:59
User 5924124-Mar-14 15:59 
QuestionRe: Free fails with Access violation reading location Pin
User 5924124-Mar-14 15:17
User 5924124-Mar-14 15:17 
AnswerRe: Free fails with Access violation reading location Pin
tejaswini_g24-Mar-14 15:39
tejaswini_g24-Mar-14 15:39 
AnswerRe: Free fails with Access violation reading location Pin
User 5924124-Mar-14 16:01
User 5924124-Mar-14 16:01 
GeneralRe: Free fails with Access violation reading location Pin
tejaswini_g24-Mar-14 16:11
tejaswini_g24-Mar-14 16:11 
QuestionHow do you define flags? Pin
Dusan Paulovic24-Mar-14 9:48
Dusan Paulovic24-Mar-14 9:48 
AnswerRe: How do you define flags? Pin
Richard MacCutchan24-Mar-14 11:11
mveRichard MacCutchan24-Mar-14 11:11 
AnswerRe: How do you define flags? Pin
Albert Holguin25-Mar-14 4:48
professionalAlbert Holguin25-Mar-14 4:48 

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.