"The strength of a civilization is not measured by its ability to wage wars, but rather by its ability to prevent them." - Gene Roddenberry
mickey (29th September 2007)
it seems that my iostream (.net2005) doens't contains method 'form' for cout (cout.form).
Is one other "C++" way to print? (apart printf). thanks.
Regards
I need a function C++ like printf to use char %c %s inside it.
cout.form was able to do this; But it seems vanished.
Regards
If you want your application to print its code, then the worst possible solution is the one you are using: store the code as a string in the actual code.
A better solution is to make the application store the code(by parsing the source files)in a separate module that will be distributed also. The module should preferably be encrypted, so only trusted users can see the code.
Last edited by marcel; 29th September 2007 at 20:30.
That's cheating.![]()
"The strength of a civilization is not measured by its ability to wage wars, but rather by its ability to prevent them." - Gene Roddenberry
What do you need it for anyway?
here, http://www.nyx.net/~gthompso/self_c++.txt
as Michiel said, there is what I need. But as you can see there is the use of cout.form, and my compiler seems don't know it. I could use the printf but I'm looking for a pure c++ function where I can use %c %s characters....
Regards
But it doesn't say what you need it for![]()
OK!! It is just for fun. But I think your target in your question was another. Is it so? I'm curious too.....
But I don't find fprintf method in string; but if it's used to write on a file as said before it's a cheat...
Regards
No... I don't think so.
sprintf not fprintf. You sprintf what you want to printf into a string and then "printf" it (by redirecting) to coutBut I don't find fprintf method in string; but if it's used to write on a file as said before it's a cheat...
Something like:
Qt Code:
std::string str; str.sprintf("Format %s", "xyz"); std::cout << str << std::endl;To copy to clipboard, switch view to plain text mode
Just make sure std::string::sprintf really exists.
it doesn't exist as part of string....(at least in .net); but I wonder where's the "form" method....
Regards
Bookmarks