473,320 Members | 1,823 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Bug in VC++ .NET 2003, stringstream and tellp

If you run this simple console program after building it on VC++ .NET 2003,
you will see the error message, "Error getting initial stream position",
from the attempt to use the std::ostream::tellp() method to get the output
stream position of a std::stringstream. I can see no reason for this error
and deem it a bug in VC++ .NET 2003. If anyone knows of a workaround or a
fix for this, I would appreciate finding out about it. BTW, where do I
officially report a bug in VC++ .NET 2003 to Microsoft ?

#include "stdafx.h"
#include <sstream>
int _tmain(int argc, _TCHAR* argv[])
{
std::stringstream stream;
std::stringstream::pos_type begpos;
stream.flush();
if (!stream)
{
std::cout << "\r\nError flushing stream\r\n";
}
begpos = stream.tellp();
if (begpos == std::stringstream::pos_type(-1))
{
std::cout << "\r\nError getting initial stream position\r\n";
}
char buffer[256];
std::cout << "\r\nPress any character and hit enter to end program\r\n";
std::cin.getline(buffer,256);
return 0;
}
Nov 16 '05 #1
1 1845
Here is generally fine for reporting VC++ bugs.

I've added microsoft.public.vc.stl & set follow-ups to that group as well -
the Dinkumware guys are frequently seen there.

-cd

Edward Diener wrote:
If you run this simple console program after building it on VC++ .NET
2003, you will see the error message, "Error getting initial stream
position", from the attempt to use the std::ostream::tellp() method
to get the output stream position of a std::stringstream. I can see
no reason for this error and deem it a bug in VC++ .NET 2003. If
anyone knows of a workaround or a fix for this, I would appreciate
finding out about it. BTW, where do I officially report a bug in VC++
.NET 2003 to Microsoft ?

#include "stdafx.h"
#include <sstream>
int _tmain(int argc, _TCHAR* argv[])
{
std::stringstream stream;
std::stringstream::pos_type begpos;
stream.flush();
if (!stream)
{
std::cout << "\r\nError flushing stream\r\n";
}
begpos = stream.tellp();
if (begpos == std::stringstream::pos_type(-1))
{
std::cout << "\r\nError getting initial stream position\r\n";
}
char buffer[256];
std::cout << "\r\nPress any character and hit enter to end
program\r\n"; std::cin.getline(buffer,256);
return 0;
}

Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Marc Schellens | last post by:
is there an easy way to clear a stringstreams contents. My problem is that I want output to be limited to 80 characters a line. So I use operator<< to a stringstream object 'oss' and if tellp() is...
5
by: cherico | last post by:
I'd like to read stings from cin and put them in stringstream. I use a string object as an intermediate "container" to store data from cin and then put them in stringstream. stringstream ss ;...
3
by: Wei-Chao Hsu | last post by:
I have an old C++ program that used "complex.h". It appeared an error when it was recompiled by MS VC.NET 2003. The compiler could not find the file "complex.h", but it will be fine if <complex>...
0
by: Sandor | last post by:
Hi, I have an application where I want to check if the buffer of a given ostream contains any characters or it is empty. The same ostream may be checked from multiple threads. Thread safety is...
4
by: Alex | last post by:
Hi there I'm switching from VC++ 6.0 to VC++ .NET 2003. Since there is no stand-alone version of VC++ .NET 2003 Pro, I went and purchased the Standard version, which does not have an...
2
by: Qiao Yun | last post by:
I used vc++.net (visual studio .net ) to open a project which can work well in vc++6.0. I succeeded in compiling the project in vc++.net in release mode . But when I tried to compile the project...
0
by: Ganapathy | last post by:
I have COM dll code written in VC 6.0. When i tried compiling this code in VC 7, The MIDL cmpiler gets called twice. i.e. it initially compiles fully & immediately a line - 64 bit processing'...
5
by: Michael | last post by:
i experience slower compile times with VC++ 2003 compared to VC+6.0. Anyone experiencing the same? Should that be expected? This ineed matters, when total compilation time is > 1h and you have to...
9
by: martinezfive | last post by:
Hi, I feel no doubt some documentation contains my answer, so bare with me. Given the following: #inclde <stdio.h> #include <sstream> void f() { std::stringstream a("Hello World!\n");
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.