Ejemplo n.º 1
0
void Manager(FILE *file, int count)
{
	char MenuNum;

	while (1)
	{
		MenuView();
		MenuNum = getch();
		puts("");

		switch (MenuNum)
		{
		case '1':
			InputStudent(file, count);
			break;
		case '2':
			ModifyStudent(file, count);
			break;
		case '3':
			DeleteStudent(file, count);
			break;
		case '4':
			PrintStudent(file, count);
			break;
		case '5':
			FilePrint(file, count);
			break;
		case '6':
			exit(1);
		default:
			printf("잘못된 입력 입니다!\n");
			printf("다시 입력해주세요\n");
		}
	}
}
Ejemplo n.º 2
0
void runReader(int input, int output) {
	STUDENT student;

	CHECK(close(output));
	while(read(input, &student, sizeof(STUDENT)) == sizeof(STUDENT)){
		PrintStudent(&student);
	}
	printf("child: vsetko precitane\n");

	CHECK(close(input));
}
Ejemplo n.º 3
0
int main(int argc, char **argv)
{
    FILE* file;
    char** lines;
    int a;
    int b;
    int i;
    int index = 0;
    const int amountLines = 5;//142400;
    const int length = 180;
    Student** students;

    lines = (char**)malloc(sizeof(char*)*amountLines);

    students = (Student**)malloc(sizeof(Student*)*amountLines);

    for (i = 0; i < amountLines; i++)
    {
        lines[i] = (char*)malloc(sizeof(char)*length);
    }

    if(argc > 1)
    {
        file = fopen(argv[1],"r");
    }
    else
    {
        return 1;
    }
    while (!feof(file) && index < amountLines)
    {        
        fgets(lines[index++],length,file);
    }

    for (i = 0; i < amountLines; i++)
    {
        students[i] = NewStudent(15,50);
        PrintStudent(students[i]);
    }

    for (i = 0; i < amountLines; i++)
    {
        free(lines[i]);
    }
    for (i = 0; i < amountLines; i++)
    {
        DepartStudent( students[i] );
    }
    free(students);
    free(lines);
    fclose(file);
    return 0;
}