Assignments/HW1/untitled folder/submission/mystrings.c
void MyStrings (char * fileName){
    //GetFileSize
    DWORD fileSize;
    char* buffer;
    
    // //your solution here!
    FILE *fp;
    fp = fopen(fileName, "rb");
    if(fp == NULL)
    {
        printf("File does not exist\n");
    }

    fseek(fp, 0, SEEK_END);
    fileSize = ftell(fp);
    fseek(fp, 0, SEEK_SET);

    buffer = (char*) malloc(fileSize);
    fread(buffer, fileSize, 1, fp);
    // printf("%d\n", fileSize);
    // printf("pointer is at %x and filesize is %x", buffer, fileSize);
    fclose(fp);
    // printf("sum is %x\n", buffer+fileSize);

    FindString(buffer, fileSize);
    // free(buffer);

}
// Loads The file contents, calculates the size, then calls FindStr
Loads The file contents, calculates the size, then calls FindStr
Loads The file contents calculates the size then calls FindStr
void MyStrings (char * fileName){
    DWORD fileSize;
    char* buffer;
    FILE *fp;
    fp = fopen(fileName, "rb");
    if(fp == NULL)
    {
        printf("File does not exist\n");
    }
    fseek(fp, 0, SEEK_END);
    fileSize = ftell(fp);
    fseek(fp, 0, SEEK_SET);
    buffer = (char*) malloc(fileSize);
    fread(buffer, fileSize, 1, fp);
    fclose(fp);
    FindString(buffer, fileSize);
}
void MyStrings ( char * fileName ) { DWORD fileSize ; char * buffer ; FILE * fp ; fp = fopen ( fileName , " " ) ; if ( fp == NULL ) { printf ( " \n " ) ; } fseek ( fp , 0 , SEEK_END ) ; fileSize = ftell ( fp ) ; fseek ( fp , 0 , SEEK_SET ) ; buffer = ( char * ) malloc ( fileSize ) ; fread ( buffer , fileSize , 1 , fp ) ; fclose ( fp ) ; FindString ( buffer , fileSize ) ; }
Loads The file contents, calculates the size, then calls FindStr
Loads The file contents calculates the size then calls FindStr
//GetFileSize // //your solution here! // printf("%d\n", fileSize); // printf("pointer is at %x and filesize is %x", buffer, fileSize); // printf("sum is %x\n", buffer+fileSize); // free(buffer);