i m trying to finish this mail extractor as exersise for FILE I/O i just learned but so far i goten till check for the @ button this how far i have gotten
Code:#include "includes.h"
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
#define FNAME "D:\\Karim test folder\\two.html"
FILE*fptr;
void close_the_file();
void pause();
/*
*pause()
*
*asks the user to press enter
*this function is used in conjuction with atexit()
*/
void close_the_file()
{
fclose(fptr);
}
void pause()
{
printf("\nprogram ended ,Please press enter: ");
fflush(stdin);
getchar();
}
int main(void)
{
char array[600];
int count=0;
unsigned int i;
atexit(pause);
fptr=fopen(FNAME,"r");
if(fptr=NULL)
{
fprintf(stderr,"Coudnt not open \n",FNAME);
exit(1);
}
atexit(close_the_file);
printf("The lines are as follows %s",FNAME);
while(fgets(array,sizeof array,fptr)!=NULL);
for( i = 0; i <strlen( array ); i++ )
{
if(array[i]=='@')
{
fputs(array,stdout);
}
}
return 0;
}