Click here to Skip to main content
15,885,985 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Simple anti virus project (Argv FILE* dirent.h) Pin
a random user24-May-15 7:20
a random user24-May-15 7:20 
GeneralRe: Simple anti virus project (Argv FILE* dirent.h) Pin
Richard MacCutchan24-May-15 21:36
mveRichard MacCutchan24-May-15 21:36 
GeneralRe: Simple anti virus project (Argv FILE* dirent.h) Pin
a random user25-May-15 2:24
a random user25-May-15 2:24 
GeneralRe: Simple anti virus project (Argv FILE* dirent.h) Pin
Richard MacCutchan25-May-15 2:33
mveRichard MacCutchan25-May-15 2:33 
GeneralRe: Simple anti virus project (Argv FILE* dirent.h) Pin
a random user25-May-15 2:59
a random user25-May-15 2:59 
GeneralRe: Simple anti virus project (Argv FILE* dirent.h) Pin
Richard MacCutchan25-May-15 3:25
mveRichard MacCutchan25-May-15 3:25 
GeneralRe: Simple anti virus project (Argv FILE* dirent.h) Pin
a random user25-May-15 3:34
a random user25-May-15 3:34 
QuestionC language Help using Dirent.h Pin
a random user22-May-15 6:24
a random user22-May-15 6:24 
well.. im trying to open a folder with an unknown number of programs

using argv and argc through the cmd to the adress of the folder

i need to use the dirent.h and maybe the FILE struct
to open the files

the code needs to open each file and search the text within (it has mp3 signatures etc) in a binary way and search through it with a second file that the text inside of it is not in any place in there

in other words i need to spot if the second file's signature is nto repeatign anywhere on the other files


this is the far that i got but im stuck
can anyone help me?



C#
#include <stdio.h>
#include <stdlib.h>
#include "dirent.h"


int main(int argc, char** argv){





    int count = 0, size = 0;
    int sizes[3];
    FILE *log = fopen("C:\\Users\\win7\\Desktop\\1\\C2_Mid_Anti-Virus_Project.zip\\AntiVirusLog.txt", "wt");
    DIR *dir;
    struct dirent *ent;
    int found = 0;

    /* Open directory */

    dir = opendir(argv[1]);



    while ((ent = readdir(dir)))
    {
        count++;


        sizes[0] = strlen(argv[1]);
        sizes[1] = 2;
        sizes[2] = strlen(ent->d_name);
        size += sizes[0] + sizes[1] + sizes[2] + 1;

        char* string = (char*)malloc(sizeof(char)*size);
        _flushall();
        strcpy(string,argv[1]);
        strcat(string, "\\");
        strcat(string, ent->d_name);

        FILE* youtube = fopen (string, "rb");

        if (youtube != NULL)
        {
            print("success \n");
        }

        puts(ent->d_name);
    }





    fclose(log);
    closedir(dir);



    return 0;
}

SuggestionRe: C language Help using Dirent.h Pin
Richard MacCutchan22-May-15 7:19
mveRichard MacCutchan22-May-15 7:19 
AnswerRe: C language Help using Dirent.h Pin
k505422-May-15 7:37
mvek505422-May-15 7:37 
GeneralRe: C language Help using Dirent.h Pin
a random user23-May-15 1:06
a random user23-May-15 1:06 
GeneralRe: C language Help using Dirent.h Pin
Richard MacCutchan23-May-15 2:15
mveRichard MacCutchan23-May-15 2:15 
GeneralRe: C language Help using Dirent.h Pin
a random user23-May-15 2:56
a random user23-May-15 2:56 
GeneralRe: C language Help using Dirent.h Pin
Richard MacCutchan23-May-15 3:04
mveRichard MacCutchan23-May-15 3:04 
GeneralRe: C language Help using Dirent.h Pin
a random user23-May-15 3:08
a random user23-May-15 3:08 
GeneralRe: C language Help using Dirent.h Pin
a random user23-May-15 3:45
a random user23-May-15 3:45 
GeneralRe: C language Help using Dirent.h Pin
Richard MacCutchan23-May-15 6:27
mveRichard MacCutchan23-May-15 6:27 
QuestionRe: C language Help using Dirent.h Pin
a random user23-May-15 9:47
a random user23-May-15 9:47 
AnswerRe: C language Help using Dirent.h Pin
Richard MacCutchan23-May-15 20:58
mveRichard MacCutchan23-May-15 20:58 
GeneralRe: C language Help using Dirent.h Pin
a random user23-May-15 23:05
a random user23-May-15 23:05 
GeneralRe: C language Help using Dirent.h Pin
a random user23-May-15 23:19
a random user23-May-15 23:19 
GeneralRe: C language Help using Dirent.h Pin
a random user24-May-15 2:08
a random user24-May-15 2:08 
GeneralRe: C language Help using Dirent.h Pin
Richard MacCutchan24-May-15 2:19
mveRichard MacCutchan24-May-15 2:19 
GeneralRe: C language Help using Dirent.h Pin
a random user24-May-15 2:51
a random user24-May-15 2:51 
GeneralRe: C language Help using Dirent.h Pin
Richard MacCutchan24-May-15 3:08
mveRichard MacCutchan24-May-15 3:08 

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.