M
Madhur
Hello
what about this nice way to open a file in single line rather than using
if and else.
#include<stdio.h>
void main()
{
FILE *nd;
clrscr();
fopen("c:\\autoexec.bat","r")&&printf("success") || printf("error opeing
file")&&exit(1);
}
if the file exists condition to right of OR will not be executed and if it
doesnt exists it returns 0 and cause the second
condition to be executed.
printf always returns nonzero on success.
--
Winners dont do different things, they do things differently.
Madhur Ahuja
India
email : madhur<underscore>ahuja<at>yahoo<dot>com
what about this nice way to open a file in single line rather than using
if and else.
#include<stdio.h>
void main()
{
FILE *nd;
clrscr();
fopen("c:\\autoexec.bat","r")&&printf("success") || printf("error opeing
file")&&exit(1);
}
if the file exists condition to right of OR will not be executed and if it
doesnt exists it returns 0 and cause the second
condition to be executed.
printf always returns nonzero on success.
--
Winners dont do different things, they do things differently.
Madhur Ahuja
India
email : madhur<underscore>ahuja<at>yahoo<dot>com