37. | #include<stdio.h>
#include <errno.h>
int main()
{
errno = 0;
FILE *fb = fopen("/home/jeegar/","r");
if(fb==NULL)
printf("its null");
else
printf("working");
printf("Error %d \n", errno);
}
|
|||||||
|
38. | Will the following code compile? If yes, then is there any other problem with this code? #include
void main(void)
{
char *ptr = (char*)malloc(10);
if(NULL == ptr)
{
printf("\n Malloc failed \n");
return;
}
else
{
// Do some processing
free(ptr);
}
return;
}
|
|||||||
|
39. | Following code is Add text to a file which already exists and there is some text in the file.is it correct r not #include
int main()
{
FILE *fp
file = fopen("file.txt","a");
fprintf(fp,"%s","This is just an example :)"); /*append some text*/
fclose(fp);
return 0;
}
|
|||||||
|
40. | if(student_file = fopen("s.dat", "w")) == NULL) {
/* do this */
) else {
/* do that */
}
The type of "student_file" should be
|
|||||||
|
41. | Consider the following program fragment, assuming the #include
FILE *stream;
textfile = "file.txt";How could the file file.txt (present in the current directory) be opened for reading?
|
|||||||
|
« previous
1
2
3
4
5
6
7