Project Name : " Employee Information System "
I am trying to add a new department name in "dept.txt" file.
using file Operations and funcctions defined in String Header file in C
Problem is in fnAddDepartment() function. When i run program in VC++ compiler, it says :
Debug Assertion Failed!
Program: F:\EIS\dept1\Debug\dept1.exe
File:fgets.c

Expression : str!=NULL

the text file " dept.txt" has following data stored:
"1000CCD
1001Human Resources
1002BCMD"

*****************************************************/
* Filename    : FileFunctions.h

* Date        : 24-Feb-2005
* Description : Declaration of functions and constants required to use the functions defined
***********************************************/

/* Pre-defined constants */

/* Constants to choose Dept file or Employee file */
#define DEP_FILE 1
#define EMP_FILE 2

/* Constants to define position in file */
#define BEGIN 0
#define CURRENT 1 

/* Length of records */
#define EMP_RECLEN 50
#define DEPT_RECLEN 50

/* end of file and file related error codes */

#define ERROR_OPEN_FILE -2
#define ERROR_CLOSE_FILE -3
#define FILE_OPENED 3
#define FILE_CLOSED 4
#define END_OF_FILE -1
#define RECORD_READ_SUCCESS 4
#define RECORD_UPDATE_SUCCESS 5

FILE *fpDept;
FILE *fpEmp;

/* Function declarations */

int fnOpenFile ( int iFile );
int fnReadFile ( char acLine[], int iFile, int ipos);
void fnWriteFile ( char acLine[], int iFile);
int fnUpdateFile ( char acLine[], int iFile);
int fnCloseFile ( int iFile);

/******************************************************************************
* End of FileFunctions.h
******************************************************************************/

/* All the necessary header files included */

#include<stdio.h>
#include<stdlib.h>
#include<FileFunctions.h> /* a user defined header file */
#include<conio.h>
#include<string.h>
#include<windows.h>


/* Declare the prototypes of functions used */
void fnGotoxy(int icoord_x, int icoord_y);
void fnDisplayMainMenu();
void fnDisplayDepartmentMenu();
void fnAddDepartment();
void fnUpdateDepartmentName();
void fnPrintDepartmentDetails();
void fnGotoMainMenu();
int AutoGenerateDepartmentCode();


/* Defining Macros */
# define FIELD_SIZE 25
# define ARR_TEMP_SIZE 16


/******************************************************************************************
* Function name    : main 
* Description      : It displays the Main Menu and all the functions and modules are
                     integrated in this function.
* Input Parameters : 
* int agrc - Number of command line arguments
* char **argv - The command line arguments passed
* Returns - 0 on successful completion of program to operating system
********************************************************************************************/

int main (int argc, char **argv){
	
	fnGotoxy(25,5);
	printf(" Employee Information System ");
	fnGotoxy(25,6);
	printf(" ============================ ");
	fnGotoxy(25,8);
	printf(" Login Screen ");
	fnGotoxy(25,9);
	printf("=============");
	fnDisplayMainMenu();
	return 0;
}
/**********************************************************************************************
* Function name  : fnGotoxy
* Description    : It moves the cursor to the given coordinate position on screen.
				   
*Input Parameters: 
*int icoord_x    : The given x coordiante. It is of integer datatype.
*int icoord_y    : The given y coordinate . It is of integer datatype
*Returns         : void
***********************************************************************************************/
void fnGotoxy(int icoord_x,int icoord_y)
{
  static HANDLE hStdout = NULL;
  COORD coord;

  coord.X = icoord_x;
  coord.Y = icoord_y;

  if(!hStdout)
  {
    hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
  }
  
  SetConsoleCursorPosition(hStdout,coord);
}
   
void clrscr(void)
{
  static HANDLE hStdout = NULL;      
  static CONSOLE_SCREEN_BUFFER_INFO csbi;
  const COORD startCoords = {0,0};   
  DWORD dummy;
  
  if(!hStdout)               
  {
    hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
    GetConsoleScreenBufferInfo(hStdout,&csbi);
  }
  
  FillConsoleOutputCharacter(hStdout,
                             ' ',
                             csbi.dwSize.X * csbi.dwSize.Y,
                             startCoords,
                             &dummy);    
  fnGotoxy(0,0);
}




void fnDisplayMainMenu()
{
  char cChoice;
	        system("cls");
            fnGotoxy(25,5);
	        printf(" Employee Information System ");
	        fnGotoxy(25,6);
	        printf(" ============================ ");
	        fnGotoxy(29,8);
	        printf(" Main Menu");
	        fnGotoxy(29,9);
	        printf("=============");
			fnGotoxy(25,12);
			printf("1. Department Maintenance");
			fnGotoxy(25,13);
            printf("2. Employee Maintenance ");
			fnGotoxy(25,14);
            printf("3. Telephone Directory Maintenance ");
			fnGotoxy(25,15);
            printf("4. Reports ");
			fnGotoxy(25,16);
            printf("5. Exit ");
			fnGotoxy(25,17);
			printf("Enter Your Choice : ");
			cChoice = getchar();
switch(cChoice)
	{
		case '1':
			fnDisplayDepartmentMenu();
			break;
		case '2':
			fnEmployeeMasterMaintenance();
			break;
        case '3':
			fnTelephoneDirectoryMaintenance();
			break;
        case '4':
			fnReports();
			break;
		case '5':
			fnExit();
			break;
        default:
			printf(" Please enter the correct choice : ");
	}
            
		
}

/********************************************************************************************
* Function name  : fnDisplayDepartmentMenu()
* Description    : It displays the Department Menu.
				   
*Input Parameters: None
*Returns         : void
***********************************************************************************************/
void fnDisplayDepartmentMenu()
{
char cChoice1;
          system("cls");
          fnGotoxy(25,5);
          printf("Employee Information System");
          fnGotoxy(25,6);
          printf("===========================");
          fnGotoxy(25,8);
          printf(" Department Maintenance Menu");
          fnGotoxy(25,9);
          printf(" ==========================");
          fnGotoxy(25,12);
          printf(" 1. Add Department");
          fnGotoxy(25,13);
          printf(" 2. Update Department Name ");
          fnGotoxy(25,14);
          printf(" 3. Print Department Details ");
          fnGotoxy(25,15);
          printf(" 4. Goto Main Menu ");
          fnGotoxy(25,17);
          printf(" Enter your Choice : ");
		  fflush(stdin);
          cChoice1 = getchar();
switch(cChoice1)
	{
		case '1':
			fnAddDepartment();
			break;
		case '2':
			fnUpdateDepartmentName();
			break;
        case '3':
			fnPrintDepartmentDetails();
			break;
        case '4':
			fnGotoMainMenu();
			break;
		default:
			printf("Please enter correct choice :");


	}
	  
	  
}



/******************************************************************************
* Function: fnOpenFile                 	
* Description: Opens a file specified by the parameter. Looks for the file 
*		in the current working directory.
* Input Parameters: 
* 	int iFile - The file to be opened. Can have values
*		DEP_FILE - Opens Department file (dept.txt)
*		EMP_FILE - Opens Employee file (emp.txt)
* Returns : FILE_OPENED on success. ERROR_OPEN_FILE if an error occurs 
*           when opening a file
******************************************************************************/

int fnOpenFile ( int iFile )
{
	char acFileName[20];

	switch (iFile) {

		case DEP_FILE:
			strcpy (acFileName, "dept.txt");
			fpDept = fopen(acFileName, "r+");
			if (NULL == fpDept) {
				return ERROR_OPEN_FILE;
			}
			break;

		case EMP_FILE:
			strcpy (acFileName, "emp.txt");
			fpEmp = fopen(acFileName, "r+");
			if (NULL == fpEmp) {
				return ERROR_OPEN_FILE;
			}
			break;

		default:
			return FILE_OPENED;
			break;
	}
	return 0;
}

/******************************************************************************
* Function: fnWriteFile
* Description: Adds a record (one line) from the array acLine[] into a file 
*              specified by parameter iFile
* Input Parameters: 
* 	char acLine[] - character array whose contents have to be written
* 	int iFile - The file into which record has to be added. Can have values
*		DEP_FILE - reads from Department file (dept.txt)
*		EMP_FILE - reads from Employee file (emp.txt)
* Returns: None
******************************************************************************/

void fnWriteFile ( char acLine[], int iFile)
{	

	switch (iFile)
	{
		case DEP_FILE:
			
			fseek(fpDept, 0L, SEEK_END);
					
			fprintf (fpDept, "%s\n", acLine);
			break;

		case EMP_FILE:
			
			fseek(fpEmp, 0L, SEEK_END);
			fprintf (fpEmp, "%s\n", acLine);
			break;
		
	}


}


/******************************************************************************
* Function: fnCloseFile
* Description: Closes the file specified in the parameter.
* Input Parameters: 
* 	int iFile - The file which has to be closed. Can have values
*		DEP_FILE - reads from Department file (dept.txt)
*		EMP_FILE - reads from Employee file (emp.txt)
* Returns: FILE_CLOSED on success. 1 on error
******************************************************************************/

int fnCloseFile ( int iFile)
{
	switch (iFile)
	{
		case DEP_FILE:
			if (fclose (fpDept)) {
				return ERROR_CLOSE_FILE;
			}
			break;

		case EMP_FILE:
			if (fclose (fpEmp)) {
				return ERROR_CLOSE_FILE;
			}
			break;

		default:
			return ERROR_CLOSE_FILE;
			break;
	}

	return FILE_CLOSED;
}

int AutoGenerateDepartmentCode()
{
	static int iIncrement=1002;
	iIncrement++;
	return iIncrement;
}

void fnAddDepartment()
{
	int iCheck=0;
	int iRet=0;
	int iCount=0;
	int iLength=0;
	int Dept_Code=0;
	char Dept_Name[16];
    static char ArrTemp[ARR_TEMP_SIZE];
	char acLine[25];
	char aCompare[DEPT_RECLEN];
	FILE *fpD;

	
	system("cls");
	fpD=fopen("dept.txt", "r");
	fnGotoxy(25,5);
printf("Employee Information System");
fnGotoxy(25,6);
printf("===========================");
fnGotoxy(25,8);
printf(" Add a Department");
fnGotoxy(25,9);
printf(" ==========================");
fnGotoxy(20,11);
printf("Enter a new Department Name :");
fflush(stdout);
fgets(ArrTemp, ARR_TEMP_SIZE, stdin);
for(iLength=0; iLength<ARR_TEMP_SIZE; iLength++)
{

ArrTemp[iLength]=Dept_Name[iLength];
}
if(fpD=NULL)
{
	fnGotoxy(20,15);
	printf(" Cannot open file \"dept.txt\" ");
	exit(0);
}

if(fgets(aCompare, DEPT_RECLEN, fpD)== NULL )
{
	printf(" dept.txt file is empty");
}
else
{
    if(strstr(aCompare, Dept_Name)==NULL)
	{
	
	for(iCount=0; iCount<ARR_TEMP_SIZE; iCount++)
	{
		if(Dept_Name[iCount]==32 || Dept_Name[iCount]==38 || Dept_Name[iCount]==45 || 
		   (Dept_Name[iCount] >= 65 && Dept_Name[iCount] <= 90) || (Dept_Name[iCount] >= 97 && 
		    Dept_Name[iCount] <=122))
		{
			iCheck = strlen(Dept_Name);
			if(iCheck <3 || iCheck > 15)
			{
				fnGotoxy(20,15);
				printf(" ERROR : Invalid Length of Department Name ");
				fnGotoxy(20,17);
				printf(" Please reenter department name ");
				fnAddDepartment();
			}
			else
			{
				if(Dept_Name[0] >= 65 && Dept_Name[0] <= 90)
				{
					Dept_Code=AutoGenerateDepartmentCode();
					fnGotoxy(25,13);
					printf("Department Code : %d",Dept_Code);
					fnOpenFile(DEP_FILE);
					sprintf(acLine, "-20%s %4d", Dept_Name, Dept_Code);
					fnGotoxy(25,15);
					printf("%s",acLine);
					fnWriteFile(acLine, DEP_FILE);
					fnCloseFile(DEP_FILE);
					fnGotoxy(25,17);
					printf(" Department Name succesfully Added!! ");
					fnGotoxy(25,19);
					printf("Press any Key to go back to Department Maintenance Menu.. ");
					getch();
					fnDisplayDepartmentMenu();
				}
				else
				{
					fnGotoxy(25,15);
					printf(" The first word of the entered department name should be a CAPITAL letter ");
					fnGotoxy(25,17);
					printf(" Please reenter the department name...");
					fnAddDepartment();
				}
			}
		}
			else
			{
				fnGotoxy(25,17);
				printf(" Invalid Department Name entered..");
				fnGotoxy(25,18);
				printf("Please reenter the department name");
				fnAddDepartment();
			}
	}
	}
	else
	{
		fnGotoxy(20,15);
	    printf(" This Department is already in record ");
	    fnAddDepartment();
	}
}
}

Recommended Answers

All 5 Replies

The problems I see in that function:
1) using getch() -- see this.
2) recursively calling fnAddDepartment(); because an invalid department entered. Should simply loop back to reenter the value.
3) Your formatting does not make it easy to read the function. See this about formatting.

problems in fnAddDepartment():

fgets(ArrTemp, ARR_TEMP_SIZE, stdin);
    for(iLength=0; iLength<ARR_TEMP_SIZE; iLength++)
    {
        ArrTemp[iLength]=Dept_Name[iLength];
    }

The first line gets input into ArrTemp, the remaining 3 lines overwrite the input with the previous name (which at the time it is used is undefined.)

You should be using looping constructs inside fnAddDepartment() and not just calling fnAddDepartment() again if you have a problem. (Mentioned in WaltP's post)

The target buffer char acLine[25]; is not big enough to handle the default case for sprintf(acLine, "-20%s %4d", Dept_Name, Dept_Code); The minimum number of characters to hold that print is 26 (with the terminating '\0'). The function you use (sprintf) will NOT check and will NOT care. There might be special cases (if Dept_Name was ever longer than 20 characters, or if Dept_Code was > 9999) where it might need more characters.

I suspect the first issue above is the one that's causing your present trouble, though the second one is problematic and the third will overwrite one byte of memory not belonging to the output string.

> printf("===========================");
> fnGotoxy(25,8);
I know these seem important, but they're not. Just rip them all out until you've got the core program working, after which it's dead easy to put them all back again.
Such eye candy only makes the code a lot longer than it needs to be, and distracts you from taking care of the real problems in the code.

> fnOpenFile(DEP_FILE);
How about paying attention to the return result of this function?
Like having tried to open a file for writing, which you've already got open for reading.

Here's how I know
> Debug Assertion Failed!
> Program: F:\EIS\dept1\Debug\dept1.exe
> File:fgets.c
You failed to open a file, so your FILE * pointer is NULL.
This is what this debug assertion is telling you, that you passed NULL as the stream to some file reading function.

@WaltP @Murtan @Salem
Thank you so much for your help. I am now writing the details of the fnAddDepartment() function. The fnAddDepartment () is expected to have following implications:
1. Accept the Department Name.
2. The Department Name should not exceed 15 characters and it should contain mimimum 3 characters.The department name can contain only alphabets (uppercase or lowercase),blank space, hyphen(-), ampersand (&). The first character in the department name should be an uppercase alphabet
3. Department names cannot be duplicated.Comparison should be case insensitive.
4. When an invalid department name is entered,display an error msg and aske the user to reenter.
5. The department code should be generated by the system and department code should start with 1000. Eevry new department added should get a 1 up number for department code.
6. The department code should be unique.
7.When user finishes adding a new department. The control should be returned back to "Department MAintenance Screen" after dispalying msg that "Department successfully added ".

I have tried to optimize and present code this time with comments at appropriate places. I hope this will be much helpful than previous pos of mine. If you ahev any further suggestions than plz do reply.

#include<stdio.h>
#include<stdlib.h>
#include<FileFunctions.h> /* a user defined header file */
#include<conio.h>
#include<string.h>
#include<windows.h>

/* Declare the prototypes of functions used */
void fnDisplayMainMenu();
void fnDisplayDepartmentMenu();
void fnAddDepartment();
void fnUpdateDepartmentName();
void fnPrintDepartmentDetails();
void fnGotoMainMenu();
int AutoGenerateDepartmentCode();

/* Defining Macros */
# define FIELD_SIZE 25
# define ARR_TEMP_SIZE 16

int main (int argc, char **argv){
	fnDisplayMainMenu();
	return 0;
}
void fnDisplayMainMenu()
{
  char cChoice;
printf(" Employee Information System ");
printf(" Main Menu");
printf("1. Department Maintenance");
printf("2. Employee Maintenance ");
 printf("3. Telephone Directory Maintenance ");
printf("4. Reports ");
printf("5. Exit ");
printf("Enter Your Choice : ");
fflush(stdin);
cChoice = getchar();
switch(cChoice)
	{
		case '1':
			fnDisplayDepartmentMenu();
			break;
		case '2':
			fnEmployeeMasterMaintenance();
			break;
                               case '3':
			fnTelephoneDirectoryMaintenance();
			break;
                              case '4':
			fnReports();
			break;
		case '5':
			fnExit();
			break;
                                default:
			printf(" Please enter the correct choice : ");
	}		
}

void fnDisplayDepartmentMenu()
{
char cChoice1;
printf("Employee Information System");
printf(" Department Maintenance Menu");
 printf(" 1. Add Department");
 printf(" 2. Update Department Name ");
printf(" 3. Print Department Details ");
printf(" 4. Goto Main Menu ");
 printf(" Enter your Choice : ");
fflush(stdin);
cChoice1 = getchar();
switch(cChoice1)
	{
		case '1':
			fnAddDepartment();
			break;
		case '2':
			fnUpdateDepartmentName();
			break;
        case '3':
			fnPrintDepartmentDetails();
			break;
        case '4':
			fnGotoMainMenu();
			break;
		default:
			printf("Please enter correct choice :");
}
}

int fnOpenFile ( int iFile )
{
	char acFileName[20];
                switch (iFile) {

		case DEP_FILE:
			strcpy (acFileName, "dept.txt");
			fpDept = fopen(acFileName, "r+");
			if (NULL == fpDept) {
				return ERROR_OPEN_FILE;
			}
			break;

		case EMP_FILE:
			strcpy (acFileName, "emp.txt");
			fpEmp = fopen(acFileName, "r+");
			if (NULL == fpEmp) {
				return ERROR_OPEN_FILE;
			}
			break;

		default:
			return FILE_OPENED;
			break;
	}
	return 0;
}

void fnWriteFile ( char acLine[], int iFile)
{	
             switch (iFile)
	{
		case DEP_FILE:
			
			fseek(fpDept, 0L, SEEK_END);
					
			fprintf (fpDept, "%s\n", acLine);
			break;

		case EMP_FILE:
			
			fseek(fpEmp, 0L, SEEK_END);
			fprintf (fpEmp, "%s\n", acLine);
			break;
		
	}
}

int fnCloseFile ( int iFile)
{
	switch (iFile)
	{
		case DEP_FILE:
			if (fclose (fpDept)) {
				return ERROR_CLOSE_FILE;
			}
			break;

		case EMP_FILE:
			if (fclose (fpEmp)) {
				return ERROR_CLOSE_FILE;
			}
			break;

		default:
			return ERROR_CLOSE_FILE;
			break;
	}

	return FILE_CLOSED;
}

int AutoGenerateDepartmentCode()
{
	static int iIncrement=1002;
	iIncrement++;
	return iIncrement;
}

void fnAddDepartment()
{
/* declaration of variables */
	int iCheck=0;
	int iRet=0;
	int iCount=0;
	int iLength=0;
	int Dept_Code=0;
	char Dept_Name[ARR_TEMP_SIZE];
    static char ArrTemp[ARR_TEMP_SIZE];
	char acLine[DEPT_RECLEN];
	char aCompare[DEPT_RECLEN];
	FILE *fpD;

	fpD=fopen("dept.txt", "r");
printf(" Add a Department");
printf("Enter a new Department Name :");
fflush(stdout);

/* TAking input from user and storing it in ArrTemp array */

fgets(ArrTemp, ARR_TEMP_SIZE, stdin); 

for(iLength=0; iLength<ARR_TEMP_SIZE; iLength++)
{

/* value in ArrTemp is now stored in Dept_Name */

ArrTemp[iLength]=Dept_Name[iLength];
}
if(fpD=NULL)
{
	printf(" Cannot open file \"dept.txt\" ");
	exit(0);
}

/ * fgets() transfers the data stored in dept.txt file to array aCompare. The if condition cheks that the dept.txt is empty or not  */

if(fgets(aCompare, DEPT_RECLEN, fpD)== NULL )
{
	printf(" dept.txt file is empty");
}
else
{

/ * this if condtion searches that the dept name entered by user is already in the file dept.txt or not. This searching is done by strstr() function */
    
if(strstr(aCompare, Dept_Name)==NULL)
	{
	
	for(iCount=0; iCount<ARR_TEMP_SIZE; iCount++)
	{

/* checks that entered department name has only uppercase ,lowercase letters, '-' , '&'  */

		if(Dept_Name[iCount]==32 || Dept_Name[iCount]==38 || Dept_Name[iCount]==45 || 
		   (Dept_Name[iCount] >= 65 && Dept_Name[iCount] <= 90) || (Dept_Name[iCount] >= 97 && 
		    Dept_Name[iCount] <=122))
		{

/* checks that length is not less than 3 characters and not greater than 15 characters */
			
iCheck = strlen(Dept_Name);
			if(iCheck <3 || iCheck > 15)
			{
				printf(" ERROR : Invalid Length of Department Name ");
				printf(" Please reenter department name ");
				fnAddDepartment();
			}
			else
			{

/* checks that the first character entered for department name is an Uppercase letter */

				if(Dept_Name[0] >= 65 && Dept_Name[0] <= 90)
				{
					Dept_Code=AutoGenerateDepartmentCode();

					printf("Department Code : %d",Dept_Code);
					fnOpenFile(DEP_FILE);
					sprintf(acLine, "-20%s %4d", Dept_Name, Dept_Code);

					printf("%s",acLine);
					fnWriteFile(acLine, DEP_FILE);
					fnCloseFile(DEP_FILE);

					printf(" Department Name succesfully Added!! ");

					printf("Press any Key to go back to Department Maintenance Menu.. ");
					getch();
					fnDisplayDepartmentMenu();
				}
				else
				{
					printf(" The first word of the entered department name should be a CAPITAL letter ");

					printf(" Please reenter the department name...");
					fnAddDepartment();
				}
			}
		}
			else
			{
				printf(" Invalid Department Name entered..");
				printf("Please reenter the department name");
				fnAddDepartment();
			}
	}
	}
	else
	{
	    printf(" This Department is already in record ");
	    fnAddDepartment();
	}
}
}

I'm sorry, did you bother to read my post at all?

/* TAking input from user and storing it in ArrTemp array */

fgets(ArrTemp, ARR_TEMP_SIZE, stdin); 

for(iLength=0; iLength<ARR_TEMP_SIZE; iLength++)
{

/* value in ArrTemp is now stored in Dept_Name */

ArrTemp[iLength]=Dept_Name[iLength];
/* ** ** The above line assigns ArrTemp[ii] with the value from Dept_Name[ii]
   ** ** OVERWRITING the value the user just entered. */
}

You're still calling fnAddDepartment() from within fnAddDepartment, most times without closing the dept file.

You did fix the size of acLine.

You have your file reading all wrapped around input validation for the department name. You have code that does not depend on individual characters to validate inside the loop to validate individual characters.

Your file reading needs to be in a loop, but it is not.

Your if statement comparing each of the characters in the entered department name could be made more readable.

You have:

if(Dept_Name[iCount]==32 || Dept_Name[iCount]==38 || Dept_Name[iCount]==45 || 
		   (Dept_Name[iCount] >= 65 && Dept_Name[iCount] <= 90) || (Dept_Name[iCount] >= 97 && 
		    Dept_Name[iCount] <=122))

This is equivalent and much easier on the eyes:

if ( Dept_Name[iCount] == ' ' || 
     Dept_Name[iCount] == '&' ||
     Dept_Name[iCount] == '-' || 
    (Dept_Name[iCount] >= 'A' && Dept_Name[iCount] <= 'Z') ||
    (Dept_Name[iCount] >= 'a' && Dept_Name[iCount] <='z'))

Please modify the function to group more of the code together.
Before you even open the department file (why aren't you calling fnOpenFile() anyway?):

  • Prompt the user to enter the new department name
  • Accept the user input
  • Copy the input to Dept_Name (if this is necessary)
  • Validate the length of the entered name
  • Validate that the first character is an upper-case alphabetical character
  • Validate that all of the character in the name are valid

Now that we're pretty sure they entered something we can use:

  • Open the department file
  • While there are names still in the department file
    • Compare the name the user entered with the current line of the file
    • Save the highest department code we see
  • If we didn't find a match in the file
    • Generate a department code one higher than the highest department code in the file
    • Add the new department to the department file.
  • close the department file
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.