void List_Student_Details()
{
	FILE * output_list;
	output_list = fopen("StudentDetails.txt", "r");

	if(!output_list)
	{
		system("cls");
		printf("This File Cannot Be Open Successfully!!\n");
		printf("Please Check It!!\n");
		exit(-1);
	}
	else
	{
		system("cls");
		printf("\n");
		printf("************************ STUDENT DETAILS ************************\n");
		printf("\n");

		i = 0;

		while((fscanf(output_list,"%[^|]", &Summary[i].studNo)) != EOF)
		{
			fscanf(output_list, "%[^|]", &Student[i].regNo.year, &Student[i].regNo.campus, &Student[i].regNo.school, &Student[i].regNo.level, &Student[i].regNo.serial_number);
			fscanf(output_list, "%[^|]", &Summary[i].student_Surname);
			fscanf(output_list, "&[^|]", &Summary[i].student_givenName);
			fscanf(output_list, "%[^|]", &Summary[i].gender);
			fscanf(output_list, "%[^|]", &Student[i].father_name);
			fscanf(output_list, "%[^|]", &Student[i].address1);
			fscanf(output_list, "%[^|]", &Student[i].address2);
			fscanf(output_list, "%[^|]", &Student[i].address3);

			printf("%d ", Summary[i].studNo);
			printf("%d", Student[i].regNo.year);
			printf("%c%c%c", Student[i].regNo.campus, Student[i].regNo.school, Student[i].regNo.level);
			printf("%d ", Student[i].regNo.serial_number);
			printf("%c ", Summary[i].gender);
			printf("%s ", Summary[i].student_Surname);
			printf("%s ", Summary[i].student_givenName);
			printf("\tContact: %s\n", Student[i].address1);
			printf("\t\t\t\t\t\n", Student[i].address2);
			printf("\t\t\t\t\t\n", Student[i].address3);
			i++;
		}


		printf("\n");
		printf("************************ END OF STUDENT DETAILS ************************\n\n");
		fclose(output_list);
		system("pause");
		system("cls");
	}
}

what wrong with my code?
it giving wrong result with having alien language..:'(

this is StudentDetails

1|10WAD12345|Ang|San Ni|M|Peter|12 Jalan 4|Taman Bunga Raya|KL
2|10WAD13579|Chan|Mel Vin|M|Gary|34 Jln 5|Taman Aman|Ipoh
3|12WAD24680|Lau|Mei Li|M|Andy|56 Lorong 6|Taman HK|Johor

I don't speak alien language. Also, without knowing what went wrong (you didn't explain the problem at all) what can we say?

Maybe you should try reading one field and see if that works. If it does, read one more field. Keep adding until one full line is read.

I don't speak alien language. Also, without knowing what went wrong (you didn't explain the problem at all) what can we say?

Maybe you should try reading one field and see if that works. If it does, read one more field. Keep adding until one full line is read.

everyone also don't speak alien language, dont so lc.
i'll try on it.

well..
i have tired one by one..
but the result is wasn't giving "WAD" this answer..
it is giving me a symbols..
i just want to read from the text file and print it on the screen..

Since I can't read your screen from here, maybe you could post what you tried and show us what happened. Can't help without knowing.

owh...
i have been solved all of the problems..
thanks for helping... =D

Edited 6 Years Ago by gahhon: n/a

This question has already been answered. Start a new discussion instead.