30/09/2018, 21:46

Mở file trong C

Em có 1 file nằm trong ổ E tên là ReadFile.txt.Ý định của em là đọc file dùng lệnh mở file như sau:

FILE* fp=fopen(“E:ReadFile.txt”,“r”);

nhưng nó luôn trả về null em ko hiểu tại sao?Ai có thể giúp em vs!

*grab popcorn* viết 23:59 ngày 30/09/2018

E:\\ReadFile.txt
Bạn để E:\ReadFile.txt
Thì C nó hiểu \R = 1 ký tự

en.wikipedia.org

Escape sequences in C

Escape sequences are used in the programming languages C and C++, and also in many more languages (with some variations) like Java and C#. An escape sequence is a sequence of characters that does not represent itself when used inside a character or string literal, but is translated into another character or a sequence of characters that may be difficult or impossible to represent directly. In C, all escape sequences consist of two or more characters, the first of which is the backslash, \ (calle...

nghia viết 23:46 ngày 30/09/2018

ah sr bạn mình viết thiếu! 1 dấu ‘’ nhưng viết đủ đi nữa thì nó vẫn thông báo là NULL

viết 23:47 ngày 30/09/2018

Bạn mở File Explorer lên, vào nơi chứa file ReadFile.txt, bạn xem nếu cột Type là text document rồi thì cột Name chỉ được là ReadFile thôi

nghia viết 23:57 ngày 30/09/2018

ok thank bác làm đc rùi!

Bài liên quan
0