Thread: Function is called and I am trying to open a file

  1. #76
    Registered User
    Join Date
    Mar 2004
    Posts
    78
    I am still getting an empty file name. Here's the function again:
    Code:
    void lower(FILE *fname)
    {
    	FILE *lower;
    	
    
    	char text[81];
    	char fileName[13];
    
    	int i;
    
    	printf("\nPlease enter the name of the file you wish to open:  ");
    
    	fgets(fileName, sizeof(fileName), stdin);
    	fileName[strlen(fileName)-1]='\0';
    
    	fname=fopen(fileName, "r");
    	if (fname==NULL)
    	{
    	printf("\nThe file cannot be opened.");
    	printf("\nPlease check that the file exists.");
    	return;
    	}
    	
    	printf("\nWhat name would you like to call the new lowercase file:  ");
    
    	fgets(fileName, sizeof(fileName), stdin);
    	fileName[strlen(fileName)-1] = '\0';
    	 
    	lower = fopen(fileName, "w");
    
    	fgets(text, 81, fname);
    	text[strlen(text)-1] = '\0';
    
    	while (fgets(text, sizeof(fileName), fname) != NULL)
    	{
    	for(i = 0; i < strlen(text); i++)
    	{
    		if(isupper(text[i]))
    			text[i] = tolower(text[i]);
    	}
    	
    
    	fprintf(lower, "%s\n",text); /* Could use fputs but this works too */
    	fgets(text, 81, fname);
    	text[strlen(text)-1] = '\0';
        }
    
    	fclose(fname);
    	fclose(lower);
    }
    Now, should I get rid of:
    1.)
    Code:
     text[strlen(text)-1] = '\0' and replace it with:  if ((p = strchr(text, '\n')) != NULL) *p = '\0'
    I have a few of these in the code. I'll include the char *p;


    2.)
    Code:
    if(isupper(text[i]))
    	text[i] = tolower(text[i])
    and change to just
    Code:
     text[i] = tolower(text[i])
    I have some capital letters in the file. Won't I need the isupper? Or will the tolower just change all caps to lowercase and the lowercase letters don't chnge?

  2. #77
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Why are you trying to open the file pointer you pass it? Don't. Either don't bother passing one, or just use it as is. There's no need, and it's... ugly code.

    I have some capital letters in the file. Won't I need the isupper? Or will the tolower just change all caps to lowercase and the lowercase letters don't chnge?
    Try it and find out, or just read Hammer's post again where he tells you.

    Quzah.
    Hope is the first step on the road to disappointment.

  3. #78
    Registered User
    Join Date
    Mar 2004
    Posts
    78
    I tried to try it, but when I go to open the file that I just created, it's empty. I'm trying to rename the file that I just opened and changed to lowercase.

  4. #79
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Code:
    #include <stdio.h>
    #include <stdlib.h>
    int main( void )
    {
        FILE *fp = NULL;
        char buf[BUFSIZ] = {0};
        char *p = buf;
    
        printf("Enter a file name: ");
        fgets( buf, BUFSIZ, stdin );
        p = strchr( buf, '\n' );
        if ( p ) *p = '\0';
    
        fp = fopen( buf, "w" );
        if( fp )
        {
            fputs( buf, fp );
            fclose( fp );
        }
        return 0;
    }
    Now, modify the above to work with yours.

    Quzah.
    Hope is the first step on the road to disappointment.

  5. #80
    Registered User
    Join Date
    Mar 2004
    Posts
    78
    I figured this code out before you sent that Quazah. There are probably a lot of things wrong with the code or there are a lot of things that could be done to improve the code. For some reason, my decrypton/encrypton isnt working correctly. I'll decrypt a text file and then I'll go back the the file that's just been decrypted and I will try to encrypt it. But it's not working. I have treid a lot of scenarious. Isnt there an easy way to shorten some of this code. I sure have a lot to learn and I havent forgotten about the code you posted Quazah. Thanks for everyone's help.
    Code:
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <ctype.h>
    
    
    #define FLUSH while(getchar() != '\n')
    
    void editor(FILE*); /*function prototype*/
    void character(FILE*);
    void lower(FILE*);
    void upper(FILE*);
    void encrypt(FILE*);
    void decrypt(FILE*);
    
    
    void main()
    {
    	int ch;
    	FILE *option1=NULL;
    	FILE*option2=NULL;
    	FILE*option3=NULL;
    	FILE*option4=NULL;
    	FILE*option5=NULL;
    	FILE*option6=NULL;
    
    	int calls[7] = {0};
    
    	ch = 0;
    	while(ch != -1)
    	{
    		printf("\n\nPlease choose an option below by typing a number between 1 and 8.\n\n");
    		printf("1\tCreate text file\n\n");
    		printf("2\tCount Characters,words and sentences\n\n");
    		printf("3\tConvert to lowercase\n\n");
    		printf("4\tConvert to uppercase\n\n");
    		printf("5\tEncrypt text\n\n");	
    		printf("6\tDecrypt text\n\n");
    		printf("7\tDisplay text file\n\n");
    		printf("8\tExit program\n\n");
    		scanf(" %d", &ch);
    		FLUSH;
    
    		if(ch > 0 && ch < 8) calls[ch-1]++;
    
    		switch(ch) {
    		case 1:
    			editor(option1);
    			break;
    		case 2:
    			character(option2);
    			break;
    		case 3:
    			lower(option3);
    			break;
    		case 4:
    			upper(option4);
    			break;
    		case 5:
    			encrypt(option5);
    			break;
    		case 6:
    			decrypt(option6);
    			break;
    		}
    	}
     
    	return;
    
    }
    
    void editor(FILE *fname)
    {
    	char fileName[13];
    	char text[82];
    
    	printf("Enter the name of file to create: ");
    	fgets(fileName, sizeof(fileName), stdin);
    	fileName[strlen(fileName)-1] = '\0';
    
    
    	fname = fopen(fileName, "w");
    	if(fname == NULL)
    	{
    		printf("\nThe file cannot be opened.");
    		printf("\nPlease check that the file exists.");
    		exit(1);
    	}
    	printf("Enter the text to write to the file: ");
    	fgets(text, sizeof(text), stdin);
    	text[strlen(text)-1] = '\0';
    	 
    	fprintf(fname, "%s", text);
    
    	fclose(fname);
    }
    void character(FILE *fname)
    {
    	char text[81];
    	char fileName[13];
    
    	int count,count1,i,j,k;
    	count=0,count1=0, i=0, j=0,k=0;
    
    	printf("\nPlease enter the name of the file you wish to open:  ");
    	scanf("%s",&fileName);
    
    	fname=fopen(fileName, "r");
    	if (fname==NULL)
    	{
    	printf("\nThe file cannot be opened.");
    	printf("\nPlease check that the file exists.");
    	return;
    	}
    
    	while (fgets(text,81,fname) !=NULL)
             printf("\n%s", text);
    
    	for (i=0; text[i]!='\0';++i)
    	{	
    	count++;
    	}
    	printf("\n\nThe file you just opened:  %s,  has: %d characters, ", fileName,count);
    
    	int charNum = 0;
    	int numWords = 0;  /* Number of words found in the string */
    	int inWord = 0;    /* State:  Either in or out of a word;  0 or 1 */
    
    	/* While we don't use up our whole array */
    
    	while (text[j] != '\0') 
    	{
                    if ((text[j] == ' ') || (text[j] == '\t') ||
                     (text[j] == '\n')) 
                   {
                        inWord = 0;
                   } 
                        else if (inWord == 0) 
                  {
                        ++numWords;
                         inWord = 1;
                   } 
                       ++j;
                   }        
    	printf("%d words, and ", numWords);
    
    	for (k=0; text[k] !='\0';++k)
    	{
    	if (text[k]=='.' || text[k]=='!' || text[k]=='?')
    	{
    	count1++;
    	}
    	
    	}
    	printf("%d sentences.\n", count1);
    }
    void lower(FILE *fname)
    {
    	FILE *lower;
    	
    	char text[81];
    	char fileName[13];
    
    	int i;
    
    	printf("\nPlease enter the name of the file you wish to open:  ");
    	scanf("%s",&fileName);
    	
    	fname=fopen(fileName, "r");
    	if (fname==NULL)
    	{
    	printf("\nThe file cannot be opened.");
    	printf("\nPlease check that the file exists.");
    	return;
    	}
    	printf("\nWhat name would you like to call the new lowercase file:  ");
    	scanf("%s",&fileName);
    	 
    	lower = fopen(fileName, "w");
    
    	fgets(text, 81, fname);
    	text[strlen(text)-1] = '\0';
    
    	//while (fgets(text, sizeof(fileName), fname) != NULL)
    	
    	for(i = 0; i < strlen(text); i++)
    	{
    		text[i] = tolower(text[i]);
    	}
    	fprintf(lower, "%s\n",text); 
    	 
    	fclose(fname);
    	fclose(lower);
    }
    void upper(FILE *fname)
    {
    	FILE *upper;
    	
    	char text[81];
    	char fileName[13];
    
    	int i;
    
    	printf("\nPlease enter the name of the file you wish to open:  ");
    	scanf("%s",&fileName);
    
    	fname=fopen(fileName, "r");
    	if (fname==NULL)
    	{
    	printf("\nThe file cannot be opened.");
    	printf("\nPlease check that the file exists.");
    	return;
    	}
    	printf("\nWhat name would you like to call the new uppercase file:  ");
    	scanf("%s",&fileName);
    
    	upper = fopen(fileName, "w");
    
    	fgets(text, 81, fname);
    	text[strlen(text)-1] = '\0';
    		
    	for(i = 0; i <strlen(text); i++)
    	{
    		text[i] = toupper(text[i]);
    	}
    	fprintf(upper, "%s\n",text); 
    	 
    	fclose(fname);
    	fclose(upper);
    }
    void encrypt(FILE *fname)
    {
    	FILE*encrypt;
    
    	char fileName[13];
    	char text[82];
    
    	int i;
    
    	printf("Enter the name of file you wish to decrypt:  ");
    	scanf("%s",&fileName);
    
    	fname = fopen(fileName, "r");
    	if(fname == NULL)
    	{
    		printf("\nThe file cannot be opened.");
    		printf("\nPlease check that the file exists.");
    		return;
    	}
    
    	printf("\nWhat name would you like to call the encrypted file:  ");
    	scanf("%s",&fileName);
    
    	encrypt = fopen(fileName, "w");
    
    	fgets(text, 81, fname);
    	text[strlen(text)-1] = '\0';
    
    	for (i=0;text[i] !='\0';i++)
    	{
    	 	if(text[i] < 65 || (text[i] > 90 && text[i] < 97) || text[i] > 122 ) 
    
    		{ 		   
    			 ;
    
    		}
    
                                     else
    		{
    			if (text[i] == 'A')
    			text[i]='z';
    
    		else 
    		if	(text[i] == 'a')
    			text[i]='Z';
            
                                    else 
    		if	(text[i] == 'B')
    			text[i]='y';
    
    		else 
    		if	(text[i] == 'b')
    			text[i]='Y';
    
                                    else
                                    if (text[i] == 'C')
    			text[i]='x';
    		else
    		if (text[i] == 'c')
    			text[i]='X';
    		else
    		if (text[i] == 'D')
    			text[i]='w';
    		else
    		if (text[i] == 'd')
    			text[i]='W';
    		else
    		if (text[i] == 'E')
    			text[i]='v';
    		else
    		if (text[i] == 'e')
    			text[i]='V';
    		else
    		if (text[i] == 'F')
    			text[i]='u';
    		else
    		if (text[i] == 'f')
    			text[i]='U';
    		else
    		if (text[i] == 'G')
    			text[i]='t';
    		else
    		if (text[i] == 'g')
    			text[i]='T';
    		else 
    		{
    	                     putc(text[i] + 3, encrypt);
    		}
    	}
    }
    	fprintf(encrypt, "%s\n",text); 
    	 
    	fclose(fname);
    	fclose(encrypt);
    }
    void decrypt(FILE *fname)
    {
    	FILE*decrypt;
    
    	char fileName[13];
    	char text[82];
    
    	int i;
    
    	printf("Enter the name of file you wish to decrypt:  ");
    	scanf("%s",&fileName);
    
    	fname = fopen(fileName, "r");
    	if(fname == NULL)
    	{
    		printf("\nThe file cannot be opened.");
    		printf("\nPlease check that the file exists.");
    		return;
    	}
    
    	printf("\nWhat name would you like to call the encrypted file:  ");
    	scanf("%s",&fileName);
    
    	decrypt = fopen(fileName, "w");
    
    	fgets(text, 81, fname);
    	text[strlen(text)-1] = '\0';
    
    		for (i=0;text[i] !='\0';i++)
    	{
    	 	if(text[i] < 65 || (text[i] > 90 && text[i] < 97) || text[i] > 122 ) 
    		{ 		   
    			 ;
    		}
    
                                else
    		{
    			if (text[i] == 'z')
    			text[i]='A';
    
    		else 
    		if	(text[i] == 'Z')
    			text[i]='a';
            
                                else 
    		if	(text[i] == 'y')
    			text[i]='B';
    
    		else 
    		if	(text[i] == 'Y')
    			text[i]='b';
    
                                    else
                                    if (text[i] == 'x')
    			text[i]='C';
    		else
    		if (text[i] == 'X')
    			text[i]='c';
    		else
    		if (text[i] == 'w')
    			text[i]='D';
    		else
    		if (text[i] == 'W')
    			text[i]='d';
    		else
    		if (text[i] == 'v')
    			text[i]='E';
    		else
    		if (text[i] == 'V')
    			text[i]='e';
    		else
    		if (text[i] == 'u')
    			text[i]='F';
    		else
    		if (text[i] == 'U')
    			text[i]='f';
    		else
    		if (text[i] == 't')
    			text[i]='G';
    		else
    		if (text[i] == 'T')
    			text[i]='g';
    				else 
    		{
    		    putc(text[i] - 3, decrypt);
    		}
    		}
    }
    	fprintf(decrypt, "%s\n",text); 
    	 
    	fclose(fname);
    	fclose(decrypt);
    }

  6. #81
    Registered User
    Join Date
    Mar 2004
    Posts
    78
    I created a better way to encrypt and decrypt files. I don't know why I didnt think of this earlier. Let me know what you think:
    Code:
    void encrypt(FILE *fname)
    {
    
    	FILE*encrypt;
    
    	char fileName[13];
    	char text[82];
    
    	int i;
    
    	printf("Enter the name of file you wish to decrypt:  ");
    	scanf("%s",&fileName);
    
    	fname = fopen(fileName, "r");
    	if(fname == NULL)
    	{
    		printf("\nThe file cannot be opened.");
    		printf("\nPlease check that the file exists.");
    		return;
    	}
    
    	printf("\nWhat name would you like to call the encrypted file:  ");
    	scanf("%s",&fileName);
    
    	encrypt = fopen(fileName, "w");
    
    	fgets(text, 81, fname);
    	text[strlen(text)-1] = '\0';
    
    	for (i=0;(i<82 && text[i]!='\0');i++)
    	  text[i]=text[i]+2;
    
    	fprintf(encrypt, "%s\n",text); 
    	 
    	fclose(fname);
    	fclose(encrypt);
    }
    
    void decrypt(FILE *fname)
    {
    
    	FILE*decrypt;
    
    	char fileName[13];
    	char text[82];
    
    	int i;
    
    	printf("Enter the name of file you wish to decrypt:  ");
    	scanf("%s",&fileName);
    
    	fname = fopen(fileName, "r");
    	if(fname == NULL)
    	{
    		printf("\nThe file cannot be opened.");
    		printf("\nPlease check that the file exists.");
    		return;
    	}
    
    	printf("\nWhat name would you like to call the encrypted file:  ");
    	scanf("%s",&fileName);
    
    	decrypt = fopen(fileName, "w");
    
    	fgets(text, 81, fname);
    	text[strlen(text)-1] = '\0';
    
    	for (i=0;(i<80 && text[i]!='\0');i++)
    	  text[i]=text[i]-2;
    	
    	fprintf(decrypt, "%s\n",text); 
    	 
    	fclose(fname);
    	fclose(decrypt);
    }

  7. #82
    Registered User
    Join Date
    Mar 2004
    Posts
    78
    Can anyone tell me why I am getting a number that is always 1 higher than the number of times an option was selected? For example, If I selected option4 (5) times, it would display the number 6.
    Code:
    int calls[7] = {0};
    
    	ch = 0;
    	while(ch != -1)
    	{
    		printf("\n\nPlease choose an option below by typing a number between 1 and 8.\n\n");
    		printf("1\tCreate text file\n\n");
    		printf("2\tCount Characters,words and sentences\n\n");
    		printf("3\tConvert to lowercase\n\n");
    		printf("4\tConvert to uppercase\n\n");
    		printf("5\tEncrypt text\n\n");	
    		printf("6\tDecrypt text\n\n");
    		printf("7\tDisplay text file\n\n");
    		printf("8\tDisplay number of times each option was selected and Exit program\n\n");
    		scanf(" %d", &ch);
    		FLUSH;
    
    		if(ch > 0 && ch < 8) calls[ch-1]++;
    
    		switch(ch) {
    		case 1:
    			editor(option1);
    			break;
    		case 2:
    			character(option2);
    			break;
    		case 3:
    			lower(option3);
    			break;
    		case 4:
    			upper(option4);
    			break;
    		case 5:
    			encrypt(option5);
    			break;
    		case 6:
    			decrypt(option6);
    			break;
    		case 7:
    			display(option7);
    			break;
    		case 8:
    			system ("cls");
    			for (ch=0;ch <7; ch++)
    			{
    				calls[ch-1]++;
    			}
    			printf("\nOption1 was selected %d times", calls[0]);
    			printf("\nOption2 was selected %d times", calls[1]);
    			printf("\nOption3 was selected %d times", calls[2]);
    			printf("\nOption4 was selected %d times", calls[3]);
    			printf("\nOption5 was selected %d times", calls[4]);
    			printf("\nOption6 was selected %d times", calls[5]);
    			printf("\nOption7 was selected %d times\n", calls[6]);
    
    			exit(1);
    			break;
                            }
                   }

  8. #83
    I like code Rouss's Avatar
    Join Date
    Apr 2004
    Posts
    131
    Code:
    for (ch=0;ch <7; ch++)
    			{
    				calls[ch-1]++;
    			}
    In option 8. This adds one to the number of calls.

  9. #84
    Registered User
    Join Date
    Mar 2004
    Posts
    78
    Thanks for your help. I think I finally have this huge program completed. Huge in my standards. I really appreciate your time and patience and this also goes to everyone else who helped me.

  10. #85
    Registered User
    Join Date
    Mar 2004
    Posts
    78
    Quote Originally Posted by Rouss
    while (fgets(buf, sizeof(buf), fp) != NULL)
    {
    ...
    }

    Then you wouldn't need the read at then end either... Ofcourse, change buf to text, and fp to fname...
    When I tried to use this in my program, my code wouldn't work. I changed buf to text and fp to fname. For example, this part of code doesnt work:
    Code:
    	system ("cls");
    
    	char text[80];
    	char fileName[13];
    
    	int count,count1,i,j,k;
    	count=0,count1=0, i=0, j=0,k=0;
                    printf("\nPlease enter the name of the file you wish to open:  ");
    	scanf("%s",&fileName);
    
    	fname=fopen(fileName, "r");
    	if (fname==NULL)
    	{
    	printf("\nThe file cannot be opened.");
    	printf("\nPlease check that the file exists.");
    	return;
    	}
    
    	while (fgets(text, sizeof(fileName), fname) != NULL)
    
             printf("\n%s", text);
    
    	for (i=0; text[i]!='\0';++i)
    	{	
    	count++;
    	}
    	printf("\n\nThe file you just opened:  %s,  has: %d characters, ", fileName,count);
    
    	int charNum = 0;
    	int numWords = 0;  /* Number of words found in the string */
    	int inWord = 0;    /* State:  Either in or out of a word;  0 or 1 */
    
    	/* While we don't use up our whole array */
    
    	while (text[j] != '\0') 
    	{
             if ((text[j] == ' ') || (text[j] == '\t') ||
              (text[j] == '\n')) 
             {
              inWord = 0;
             } 
             else if (inWord == 0) 
             {
               ++numWords;
               inWord = 1;
               } 
               ++j;
             }        
    	printf("%d words, and ", numWords);
    
    	for (k=0; text[k] !='\0';++k)
    	{
    	if (text[k]=='.' || text[k]=='!' || text[k]=='?')
    	{
    	count1++;
    	}
    	
    	}
    	printf("%d sentences.\n", count1);
    When I run this code, instead of getting the correct word, character and line counts, they are ALL wrong. Not sure why that statement is preventing the code from obtaining the correct answer.

  11. #86
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    For starters, unless you have a C99 compiler, it's invalid to declare new variables scattered throughout your program. Even if you do have a C99 compiler, it's often still best to declare all of your variables at the top of your scope block, because it's a pain in the ass to hunt through your code to see if they're all there and what they all are.

    That aside...
    Code:
    while (fgets(text, sizeof(fileName), fname) != NULL)
             printf("\n%s", text);
    Why are you only reading the size of fileName bytes here, instead of text? I'll assume either it's wrong, or you have some obscure reason for it.

    Next...
    Code:
    for (i=0; text[i]!='\0';++i)
    {	
    	count++;
    }
    printf("\n\nThe file you just opened:  %s,  has: %d characters, ", fileName,count);
    Of course it's going to be wrong. You're checking text once and assuming it has magicly stored your entire file? That's wrong. You should be counting all of the chacters inside the loop where you're reading chunks of the file, and adding that to the total. Then when you've reached the end of the file, that number will hold the number of characters. (Assuming you're counting right.)

    The other counts are also going to have a similar issue.

    Quzah.
    Hope is the first step on the road to disappointment.

  12. #87
    Registered User
    Join Date
    Mar 2004
    Posts
    78
    I forgot to put text instead of fileName....Now when I replaced it with text, then it seemed to work fine. I have a small problem with option 8 again. It's printing option1 like 7 times before moving on to the rest of the options. Only option1 is repeated several times.
    Code:
    if(ch > 0 && ch < 8) calls[ch-1]++;
    
    		switch(ch) {
    		case 1:
    			editor(option1);
    			break;
    		case 2:
    			character(option2);
    			break;
    		case 3:
    			lower(option3);
    			break;
    		case 4:
    			upper(option4);
    			break;
    		case 5:
    			encrypt(option5);
    			break;
    		case 6:
    			decrypt(option6);
    			break;
    		case 7:
    			display(option7);
    			break;
    		case 8:
    			system ("cls");
    
    			for (ch=1;ch <=7; ch++)
    						
    			printf("\nOption1 was selected %d times", calls[1]);
    			printf("\nOption2 was selected %d times", calls[2]);
    			printf("\nOption3 was selected %d times", calls[3]);
    			printf("\nOption4 was selected %d times", calls[4]);
    			printf("\nOption5 was selected %d times", calls[5]);
    			printf("\nOption6 was selected %d times", calls[6]);
    			printf("\nOption7 was selected %d times\n",calls[7]);
    			getch();
    			
    			exit(1);
    			break;
    		}
    Option1 was selected 4 times
    Option1 was selected 4 times
    Option1 was selected 4 times
    Option1 was selected 4 times
    Option1 was selected 4 times
    Option1 was selected 4 times
    Option1 was selected 4 times
    Option2 was selected 2 times
    Option3 was selected 0 times
    Option4 was selected 0 times
    Option5 was selected 1 times
    Option6 was selected 0 times
    Option7 was selected 0 times

  13. #88
    Ultraviolence Connoisseur
    Join Date
    Mar 2004
    Posts
    555
    In case you didnt know if you have a for statement without braces, then the following statement will be associated with the for, and thats the only one..thats why its printing the first printf that many times, you could use the for statement like this though:

    Code:
    for (i=0;i<7;i++)
       printf("Option%d used %d times.\n",i+1,calls[i]);
    By the way you're also referencing the array incorrectly, you need to start at 0 and stop at 6. 7 is out of bounds.
    Last edited by nonpuz; 05-06-2004 at 02:04 AM.

  14. #89
    Registered User
    Join Date
    Mar 2004
    Posts
    78
    Quote Originally Posted by nonpuz
    In case you didnt know if you have a for statement without braces, then the following statement will be associated with the for, and thats the only one..thats why its printing the first printf that many times, you could use the for statement like this though:

    [code]

    By the way you're also referencing the array incorrectly, you need to start at 0 and stop at 6. 7 is out of bounds.
    Actually I didnt know that. That's why I couldn't figure it out. Thanks for telling me this. I was probably taught it, but it either slipped my mind or I wasn't paying attention in class. The for loop starts at [0] and stops at [6]. Thanks.......

Popular pages Recent additions subscribe to a feed