jilindax 发表于 2011-8-14 12:42:36

请教matalb中fprintf的使用问题

向各位高手请教:

如果在不同的函数(也就是不同的m文件)中用fprintf向文件mat.txt中多次写入,并且每次写入能够在上次的基础上继续写,应该怎么实现呢?我现在的问题是,在第一个m文件中写完后,第二个m文件再写的话就把第一次写的内容覆盖了。

谢谢!

liuyalong008 发表于 2011-8-14 16:19:12

回复 1# jilindax
fopen的属性:'r'
       

Open file for reading (default).

'w'
       

Open or create new file for writing. Discard existing contents, if any.

'a'
       

Open or create new file for writing. Append data to the end of the file.

'r+'
       

Open file for reading and writing.

'w+'
       

Open or create new file for reading and writing. Discard existing contents, if any.

'a+'
       

Open or create new file for reading and writing. Append data to the end of the file.

'A'
       

Append without automatic flushing. (Used with tape drives.)

'W'
       

Write without automatic flushing. (Used with tape drives.)
页: [1]
查看完整版本: 请教matalb中fprintf的使用问题