What does the expression "a + t" mean in the second parameter of fopen in C?

6

I was encountering a code here and I was curious about this passage:

FILE *fp = fopen("Agenda.txt","a+t");

What is "a+t" ?

    
asked by anonymous 19.05.2017 / 05:25

2 answers

7

This is the access mode to the file being opened. The "a +" indicates that you can only add data to the end of the file (append ) and can also be read ("+"). Recording must always be made official with fflush() .

"t" indicates that you can only use text , but this is not C's default Only some specific compiler accepts on specific platform, but this is considered to be an undefined behavior.

Documentation .

    
19.05.2017 / 13:13
2

According to the fopen .

"a + t" or "at +" it opens a text file in read or update mode (adding the new information at the end of the file).

    
19.05.2017 / 05:46