Dear all, I am using the keil UV2 for one of my application. In this application, I need to include files concept. For this, I write the program as follows, #include <stdio.h> int main() { FILE *fp; fp = fopen("c:\\RTC_Configuration.txt", "r"); } After compiling this program, it was showing the following error,
error c202: 'FILE' : undefined identifier error c202: 'fp' : undefined identifier
Exactly, what is this error? how can I removed from the application? Whether keil UV2 will support files concept or not?
Regards, Vijay
where do you think the file will be stored?
Right now, you are programming a PC program.
But you have specified C51 as compiler, i.e. that you are using a 8051 processor.
The 8051 is not mounted in a PC. There are no harddrive (HDD or SSD). There are no flppy drive. There are no operating system (OS) like MS-DOS or Windows XP.
If you want your programs to use files, then you must either buy, write or download code that implements a file system. And this file system implementation must interface with some memory accessible by your processor for actually storing this file data.
If the specific processor have flash sectors in the code area that can be reprogrammed by the application (IAP = In Application Programming), then that is sometimes used to just store configuration data directly. So no file system is used. The program just specifies the address in the memory, where the data is stored.
With chips that have an internal EEPROM, that is often used for storing configuration - in this case you can instead normally reprogram the data byte-by-byte.
With chips without IAP-capable flash and without internal EEPROM, you would normally have to design a system with external memory. Probably EEPROM or F-RAM connected using I2C or SPI together with a utility code to perform the actual memory accesses.
But the first thing you must realize is that you can not think "PC" when you write programs for embedded systems. They just don't have the required PC capabilities to run programs written like that.
Exactly, what is this error evidently your inability to read. in the "Enter Message Details Below" there are clear instructions how to post. well, trying to decipher the mumbo-jumbo that resulted from you not being able to follow simple instructions, that is not the only thing you can not read
Erik
The error is very clearly and explicitly stated:
error c202: 'FILE' : undefined identifier
You know what an "identifier" is - don't you? If not, it's basic 'C' textbook time! blog.antronics.co.uk/.../08
And, if you don't know what "undefined" means, you can look it up in a dictionary...
For a small, limited target like the 8051, it's important to check what limitations apply: http://www.keil.com/support/man/docs/c51/c51_xa_librarydif.htm
fp = fopen("c:\\RTC_Configuration.txt", "r");
Does your 8051 have a hard drive? Does your 8051 have a filesystem that allows it to access files as C:\RTC_Configuration.txt