bump.
Type: Posts; User: chibi.coder
bump.
I did try "rb" mode in fopen function and the results were same(forgot to mention it in earlier posts).
inputFile=fopen(fileName,"r");
fseek(inputFile,0,2);
sizeofFile=ftell(inputFile);
perror("ftell():"); sizeofFile++;
It is giving a 'perror' message as
Acutal size of the is 117406C
But ftell in the copy_file_to_buf function showing it as 114689.
fread_ret:0
ferror_ret:0
No.
I'm trying a implement program which will do a job, same as that of
CPP (The C preprocessor) when I compile a .c file.
Here in this particular code the Copy_file_to_buf fucntion not copying the...
#include<stdio.h>
#include<stdlib.h>
main(void)
{
if(fork())
{//parent process
printf("Parent process\n");
printf("par:%d\n",getpid());
}
else
char string1[255] = "Hello World";
In the above initialization the size of array is 255 bytes.
Where as for
char string1[]="Hello World";
the size of the string1 array is just 12 bytes of...
#include<stdio.h>
void print(char *p)
{
if(*p)
print(++p);
printf("%s\n",p);
}
main()
{
char *p="ABCD";
My impatience made me to post this thread :/. Sorry to bother you guys.
I'll definitely gonna reveal it. I may learn new things while revealing it. :)
^ A friend of mine has given this program and asked me for output of it without compiling on compiler. I tried but couldnt sunderstand it properly.
main()
{
int a,b,c;
int count = 1;
for (b=c=10;a="- FIGURE?, UMKC,XYZHello Folks,\
TFy!QJu ROo TNn(ROo)SLq SLq ULo+\
UHs UJq TNn*RPn/QPbEWS_JSWQAIJO^\
NBELPeHBFHT}TnALVlBLOFAkHFOuFETp\...
Read the errors before you ask for help. The answer is in your post itself. :)
Use fwrite() and fread() instead of fprintf and fscanf() respectively.
I actually meant auto type variables (variables store values automatically) .Thanks for explanation though.
Why the default initial value of automatic variables are garbage values? Why not 0 like static and global variables initial value?
use either
(void) fseek(stream, 0, SEEK_SET)
or
rewind(fp);
The above two functions will point to the initial position of a FILE. By incrementing current pointer you can read the file...
The concept EOF can be seen only in file streams (the opened files). EOF is a macro with -1 value.
You must implement your own printf function (myPrintf( )). And in that you need to write a function such that if "%n" found -do something.
user-defined printf function can be written with the...
#include<stdio.h>
main()
{
}
commands used
Use strcmp() for comparing strings.
You are comparing addresses of the strings instead of strings.
Create an object code. :P
Use 2-D array ( Array of 1-D arrays)
string[][20];//
if(condition)
is a conditional statement. If the condition results in logical 0 then the body of the loop won't be excuted whereas if the condition is logial 1 then the body of the loop will be...
when you intialize a string constant to char pointer, the stringconstant is stored in a text or code (Which is read-only file).
char *string="monkey";
So, redefine to a char array
char...
Dude, you won't get any output even if you change d=-1 to d=0.