Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C - C++ Learning > Why does it fai...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 3 Topic 4278 of 4370
Post > Topic >>

Why does it fail?

by Simen <simenfdanielsen@[EMAIL PROTECTED] > Sep 18, 2008 at 01:49 PM

I'm trying to learn some c++ and it is sometimes very frustrating :(
Can somebody help me to explain whats wrong with the line "cout << p
<< endl;", since it does't print anything.  Everything else works as
expected.  Thanks :)

#include "stdafx.h"
#include <iostream>
#include <bitset>

using namespace std;
int x;
int _tmain(int argc, _TCHAR* argv[])
{
	bitset<12> bs(64);
	const char* p = bs.to_string().c_str();
	const char* c = "kakespade";
	cout << bs.to_string() << endl;
	cout << bs.to_string().c_str() << endl;
	cout << p << endl;
	cout << c << endl;
	cin >> x;
	return 0;
}
 




 3 Posts in Topic:
Why does it fail?
Simen <simenfdanielsen  2008-09-18 13:49:18 
Re: Why does it fail?
Ulrich Eckhardt <dooms  2008-09-18 23:56:33 
Re: Why does it fail?
Simen <simenfdanielsen  2008-09-19 00:12:03 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Nov 21 16:50:47 CST 2008.