Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
F

Fossi Bluman

@Fossi Bluman
About
Posts
4
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • C fread to read 512k binary file
    F Fossi Bluman

    thank you for reply , but I use C language .

    C / C++ / MFC help question

  • C fread to read 512k binary file
    F Fossi Bluman

    then how to print the hexadecimal values in a format of two digits ?

    C / C++ / MFC help question

  • C fread to read 512k binary file
    F Fossi Bluman

    this funny "fread" doing the job , exactly as i need , any way ,, how to make it not funny ?

    C / C++ / MFC help question

  • C fread to read 512k binary file
    F Fossi Bluman

    I use the bellow code to read binary file but it throws an exceptions at run time and sometimes gives a wrong results , please tell me what's the wrong ?

    #include
    #include

    unsigned long size,n;
    int main()
    {
    unsigned char *buf;
    FILE* fp;
    fp=fopen ("myfile.bin","rb");
    if (fp == NULL) {
    fprintf(stderr, "Can't open the file");
    exit(1);}

    fseek (fp,0,SEEK\_END);	//
    size=ftell (fp);		//	get the size of the file
    fseek (fp,0,SEEK\_SET);	//
    
    if ((buf=(unsigned char\*) malloc (size+1))==0)
    	printf("\\n%s","allocation Error");
    
    n=fread (buf,sizeof (buf),size,fp);
    printf ("\\n%02x %lu bytes read",buf\[15\],n);
    
    free (buf);
    fclose (fp);
    return 0;
    

    }

    C / C++ / MFC help question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups