Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

Read Binary File in C Language

int main()
{
    FILE *file = fopen("input.txt", "r");
    char buffer[2048];

    if (file)
    {
        /* Loop will continue until an end of file is reached i.e. fread returns 0 elements read */
        while (fread(buffer, 4, 1, file) == 1)
        {
            printf("%s", buffer);
        }
        fclose(file);
    }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Read #Binary #File #C #Language
ADD COMMENT
Topic
Name
3+7 =