On 05 Apr 2007 02:11:15 -0700, Meadowcreek_99 <[EMAIL PROTECTED]>
wrote:
>
> Write a function that takes as input a string containing HTML source
> code and returns both the # of images referenced in the code and the
> total screen area (in square pixels) occupied by the images
> The function MUST have the following declarationint
> estImageContent(char *pacHTML, long int *pliArea);
>
> 1. Prompt the user for an input filename
> 2. Open the file, read its contents into a string (up to 20000 bytes),
> close file
> 3. Call estImageContent()
> 4. Print the following to the screen:
> 1. Input filename
> 2. Estimated # of images
> 3. Estimated total screen area in square pixels
> 5. Loop back to prompt
>
> this is what i have so far
> /* the first thing i did was uppercase*/
>
> #include <stdio.h>
> #include <string.h>
> #include <ctype.h>
>
> void fileToString(char filename[], char theString[]);
> char *upperCaseTheString(char *pc);
>
> int main()
> {
> char filename[] = "p6in1.txt";
> char theString[20000] = "";
>
> fileToString(filename, theString);
> upperCaseTheString(theString);
>
> printf("%s", theString);
>
> return (0);
> }
>
> void fileToString(char filename[], char theString[]) {
> FILE *fp;
> char buf[BUFSIZ+1];
>
> fp = fopen(filename, "r");
>
> while (fgets(buf, BUFSIZ, fp) != NULL) {
> strcat(theString, buf);
> }
>
> fclose(fp);
>
> }
>
> char *upperCaseTheString(char *pc) {
> char *pcReturn = pc;
>
> while (*pc != '\0') {
> *pc = toupper(*pc);
> pc++;
> }
>
> return pcReturn;
> }
> fp=fopen("p6in.txt","r");
>
> if(fp==NULL)
> {
> printf("\n\t\tSORRY......\n\t\... CANNOT OPEN FILE\n");
> return 0;
> }
>
> printf("\n\t\tFILE data.txt FOUND!\n");
> printf("\n\nSearch what string?\t");
> gets(str1);
>
> while ((fgets( str2, 100, fp )) != NULL) //not the end of file
> {
> if (strcmp(str1, str2)
> iCount++;
>
> }
> printf("\n%d OCCURRENCES OF STRING %s FOUND", iCount ,str1);
>
> }
>
> __._,_.
>
>
How are u planning to find the area of images. Are u expecting it to be
specified in IMG tags?
--
Regards
Sumit Chawla ("eNetra : Hail the Invention")
"Computers are useless. They can only give you answers.":Pablo Picasso
[Non-text portions of this message have been removed]