Assignments/HW1/untitled folder/submission/mystrings.c
void FindString(char* buffer, DWORD bufferSize){
    char asciiMin = 32;
    char asciiMax = 126;
    // //your solution here!
    
    char* charStart;
    char flag = 0;
    // char str[0];
    for(int i = 0; i < bufferSize;i++)
    {
        if(*buffer == 0 && flag == 1)
        {   
            if(buffer - charStart >= 4)
            {
                printf("<string>%s</string>\n", charStart);
            }
            flag = 0;

        }

        if(*buffer >= asciiMin && *buffer <= asciiMax)
        {
            // strncat(str, buffer, 4);
            // printf("<string>%s</string>\n", buffer);
            if(!flag)
            {
                charStart = buffer;
                flag = 1;
            }
        }
        else{
            flag = 0;
        }


        // flag = 0;
        buffer++;
    }
    // printf("Appended String: %s\n", str);
}
// FindStr takes a buffer cwith the loaded file, and its size
// It then prints all null terminiated ASCII range strings
FindStr takes a buffer cwith the loaded file, and its size
It then prints all null terminiated ASCII range strings
FindStr takes a buffer cwith the loaded file and its size It then prints all null terminiated ASCII range strings
void FindString(char* buffer, DWORD bufferSize){
    char asciiMin = 32;
    char asciiMax = 126;
    char* charStart;
    char flag = 0;
    for(int i = 0; i < bufferSize;i++)
    {
        if(*buffer == 0 && flag == 1)
        {   
            if(buffer - charStart >= 4)
            {
                printf("<string>%s</string>\n", charStart);
            }
            flag = 0;
        }
        if(*buffer >= asciiMin && *buffer <= asciiMax)
        {
            if(!flag)
            {
                charStart = buffer;
                flag = 1;
            }
        }
        else{
            flag = 0;
        }
        buffer++;
    }
}
void FindString ( char * buffer , DWORD bufferSize ) { char asciiMin = 32 ; char asciiMax = 126 ; char * charStart ; char flag = 0 ; for ( int i = 0 ; i < bufferSize ; i ++ ) { if ( * buffer == 0 && flag == 1 ) { if ( buffer - charStart >= 4 ) { printf ( " \n " , charStart ) ; } flag = 0 ; } if ( * buffer >= asciiMin && * buffer <= asciiMax ) { if ( ! flag ) { charStart = buffer ; flag = 1 ; } } else { flag = 0 ; } buffer ++ ; } }
FindStr takes a buffer cwith the loaded file, and its size
It then prints all null terminiated ASCII range strings
FindStr takes a buffer cwith the loaded file and its size It then prints all null terminiated ASCII range strings
// //your solution here! // char str[0]; // strncat(str, buffer, 4); // printf("<string>%s</string>\n", buffer); // flag = 0; // printf("Appended String: %s\n", str);