It looks a whole five days from the last time, but it is just a few blink of an eye in my eyes. Because I didn't have anything in my mind in the past few days, I have a repetition and simple life every day. How simple? That's, it is just to sit in front of the computer, you can say it all day. Ok! Ok, don't say this, this is not the focus I want to say.
I would like to ask everyone to have to learn about the document? Here is the truth, I didn't pay too much attention to it when I came to the C language. I casually turned him over (um! It's so simple, I understand, after it). I really had a bitter, I found a bitter, I found out that I didn't understand the text flow and the concept of binary stream at all. God! It is very simple from the text surface. It is not that the content is the ascii code is the text flow, and the binary flow is of course the content is binary. Haha is not simple. I think so too, the concept of text flow is to understand, but the credit will be confused. I always think that the file I opened is "101100101" in binary form, but I don't see this, but some symbols I don't know at all. All this is all of this day, but all this has passed. I truly realize that these concepts, in fact, the binary flow is not true that the content stored is 101001, which is the same as in the form of memory, so each blame is composed of these consecutive bits per 8 bits. Ugh! ~! I have suffered for so many days!
Today, I returned to the school. The first thing to say is of course the homework that is arranged during the holiday. Hey, don't tell others that my procedure is done last night, and still have bugs! Now give the original procedure for my original time:
#include
#define Size 5
TypedEf strunt student {int Num; char name [10]; int score; float avert;} student;
Void main () {file * fp; student * h, * p; int i; if ((fp = fopen ("stud.txt", "wb") == null) {Printf ("can't open the File "); exit (1);
H = p = (student *) malloc (SIZEOF (I = 0; i
For (p = h, i = 0; i
Here is two questions, I have encountered before the first question, but I didn't pay attention at the time, I was eaten today. But now the network is convenient, and the 9CBS master is like a cloud. It is of course that is 9CBS (not selling advertising. Haha). 9CBS learned that the original scanf () function has a buffer problem, so the number of endless inputs is reduced, and there is a method to give Scanf ("% D% s% d", & p-> num, p-> name , & p-> score; This sentence is plus a buffer function fflush (stdin); as for usa checks. The second question is not a problem after learning the reason, in fact, it is right. Why did I have this misunderstanding, the reason I tried to read the data to be generated, the following add some additional procedures as follows: #include
TypedEf strunt student {int Num; char name [10]; int score; float avert;} student;
Void main () {file * fp; student * h, * p; student test [size]; / * plus this definition is for the following test * / int i; if ((fp = fopen ("stud.txt" , "WB")) == NULL) {Printf ("can't open the file"); exit (1);}
H = p = (student *) malloc (SIZEOF (STUDENT)); for (i = 0; i
For (p = h, i = 0; i