Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...Thank you. It's already helped me greatly, and I enjoy just reading the inputs from the other members..."

Geography

Where in the world do Tek-Tips members come from?

Strange problem with ostringstreamHelpful Member! 

xwb (Programmer)
12 Aug 09 17:53
I'm not sure what is happening with this

CODE

std::ostringstream oss;
oss << "??/??/??";
std::string date = oss.str();
std::cout << date.c_str();
I get \??
If I try

CODE

oss << "??/";
I get a warning about a newline
xwb (Programmer)
13 Aug 09 3:09
Happens with iostream as well

CODE

#include <iostream>
int main ()
{
   std::cout << "??/??/??" << std::endl;
   return 0;
}
Looks like the / is some sort of regular expression search character.  To get the result I want, I have to change it to

CODE

#include <iostream>
int main ()
{
   std::cout << "??\/??\/??" << std::endl;
   return 0;
}
 
xwb (Programmer)
13 Aug 09 17:54
Actually that gives warnings, changed to

CODE

#include <iostream>
int main ()
{
   std::cout << "?\?/?\?/??" << std::endl;
   return 0;
}
 
Helpful Member!  uolj (Programmer)
13 Aug 09 18:53
It's a trigraph: http://en.wikipedia.org/wiki/Digraphs_and_trigraphs

Scroll down to Language Support > C to see why ??/ isn't allowed in C and C++ files.
xwb (Programmer)
14 Aug 09 8:51
Yet another thing I didn't know about C after using it for 25 years!

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Back To Forum

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close