I'm having trouble making service log, which makes .txt file from keil. I've already made the c code, and it works good for visual studio, but not in Keil. The function i use to make the .txt log file is "ofstream" and it doesn't seem to be in Keil, but there must be some other function that can build .txt file in Keil? Plz give me some advice.... Johnny Here is the C code: #include <iostream> #include <fstream> using namespace std; int main() { ofstream ServiceRapport("c:/ServiceRapport.txt",ios::app ); char navn[30]; cout << "Name: " << endl; cin >> Name; char What[300]; cout << "What has happened: " << endl; cin >> What; ServiceRapport << endl << "-------------------------------<Service Rapport>--------------------------------" << endl; ServiceRapport << "Name: " << name << endl; ServiceRapport << "Date: " << endl; ServiceRapport << "Rapport Nr: " << endl << endl; ServiceRapport << "What has happened: " << endl << endl << What << endl; return 0; }
The code you have posted is C++. Keil C51 is a 'C' compiler. I believe that a company called 'Ciebo' make a C++ add-on.
yeah, but i'm wondering if there is a function in Keil that is similar to "ofstream" ...... for example, a function or a code that can build .txt file for me, that for example prints to this .txt file, the information i want. regards Johnny
"Here is the C code:" Umm... Shouldn't that be: "Here is the C++ code:" Also, what platform are you expecting this code to run on? Just to remove any confusion you might have, Keil's C51 is a C compiler (notice the conspicuous absence of ++ following the 'C').
i'm running it on Phillips P89C664..... But which functions in Keil can build .txt file, that are similar to c++ "ofstream" ? regards Johnny
"running it on Phillips P89C664" OK, so just where exactly do you suppose that this P89C664 is going to create its files?? Have you attached a hard drive? or some solid-state mass-storage? Or what? "But which functions in Keil... The supported library functions are all detailed in the Manual. The Manual also contains a list of those ANSI "standard" functions which are not supported...
I have external ram on it........ the only thing i was wondering, is how i could make uVision create this .txt file.... There must be one or another function that can do it..... I've checked the online manual at this home page, and found function that is "log", but that function doesn't seem to work like i want it to work..... so i was wondering, is there some specialist out there who knows of another function, or isn't there any other function i can use, but "Log" ? regards Johnny
"I've checked the online manual at this home page, and found function that is "log", but that function doesn't seem to work like i want it to work..... so i was wondering, is there some specialist out there who knows of another function, or isn't there any other function i can use, but "Log" ?" You're trolling, right?
Here is list of what is included in, and omitted from, the C51 Library: http://www.keil.com/support/man/docs/c51/c51_xa_librarydif.htm In particular, note the reason stated for the omissions: "Many, however, are not applicable to an embedded application and are excluded from the Cx51 Library." (my emphasis)
Thx