* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * Authors: Nathan Binkert
*/
#include <iostream>
#include <list>
-#include <string>
#include <sstream>
+#include <string>
#include "base/cprintf.hh"
+#include "base/misc.hh"
using namespace std;
int
main()
{
- char foo[9];
+ char foo[] = "foo";
cprintf("%s\n", foo);
+ string _bar = "asdfkhasdlkfjhasdlkfhjalksdjfhalksdjhfalksdjfhalksdjhf";
+ int length = 11;
+ char bar[length + 1];
+ bar[length] = 0;
+
+ memcpy(bar, _bar.c_str(), length);
+ warn("%s\n", bar);
+
+ cprintf("%d\n", 'A');
cprintf("%shits%%s + %smisses%%s\n", "test", "test");
cprintf("%%s%-10s %c he went home \'\"%d %#o %#x %1.5f %1.2E\n",
"hello", 'A', 1, 0xff, 0xfffffffffffffULL, 3.141592653589, 1.1e10);
- cout << cformat("%s %#x %s\n") << "hello" << 0 << "foo 0\n";
- cerr << cformat("%s %#x\n") << "hello" << 1 << "foo 1\n";
-
cprintf("another test\n");
stringstream buffer;
cprintf("%c %c\n", 'c', 65);
- cout << '9';
+ cout << '9' << endl;
+
+ cout << endl;
+
+ cprintf("%08.4f\n", 99.99);
+ cprintf("%0*.*f\n", 8, 4, 99.99);
+ cprintf("%07.*f\n", 4, 1.234);
+ cprintf("%#0*x\n", 9, 123412);
return 0;
}