Quote:
Originally Posted by swatihurde
int i=0;
void main()
|
As DJ Shaji said, main should be declared as
Quote:
Originally Posted by swatihurde
{
if(fp==NULL)
{
puts("cannot open file");
exit(0);
}
else
{
|
Since you exit when the fp is NULL, there is no need for the else clause.
Quote:
Originally Posted by swatihurde
buffer=(int*) malloc(fileLen);
|
malloc returns a void pointer. In C there is a implicit conversion from
void to any pointer, so if the program will be compiled using a C
compiler (and not a C++ compiler), the cast is not needed.
Also, you should always check if malloc has actually allocated any
memory. Your file may be large or it can fail for any other reason.
Quote:
Originally Posted by swatihurde
for(i=0;i<=2;i++)
{
printf("%b",&buffer[i]);
|
I don't understand what do you want to print here, but anyway "%b" is
not in the standard. I think that Visual studio implements it, but
your program won't be portable.
I hope i helped