473,804 Members | 4,272 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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::t ellp() method to get the output
stream position of a std::stringstre am. 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::stringstre am stream;
std::stringstre am::pos_type begpos;
stream.flush();
if (!stream)
{
std::cout << "\r\nError flushing stream\r\n";
}
begpos = stream.tellp();
if (begpos == std::stringstre am::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.getlin e(buffer,256);
return 0;
}
Nov 16 '05 #1
1 1868
Here is generally fine for reporting VC++ bugs.

I've added microsoft.publi c.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::t ellp() method
to get the output stream position of a std::stringstre am. 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::stringstre am stream;
std::stringstre am::pos_type begpos;
stream.flush();
if (!stream)
{
std::cout << "\r\nError flushing stream\r\n";
}
begpos = stream.tellp();
if (begpos == std::stringstre am::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.getlin e(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
14147
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 > 80, I use operator<< to output oss.rdbuf()->str(); Afterwards I want to clear oss contents. Is there a way. pubseekpos(0) seems not to delete the former contents. Is there maybe a more elegant way to archieve what I want? I find...
5
10904
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 ; string str ; cin >> str ; ss << str ;
3
1262
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> and "using namespace std" were used. There is no problem if it is compiled by Borland CBuilderX. I don't want to modify the program because it will be a hard work. Any idea? Dennis
0
3629
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 guaranteed by having only const-access in every thread to the ostream. I believe that STL streams, just like STL containers are thread-safe if you only do const operations on them. But it turned out that the tellp method of ostream is defined as...
4
1901
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 optimizing compiler. I have been made aware of the existence of the VC++ Toolkit 2003: http://msdn.microsoft.com/visualc/vctoolkit2003/
2
5748
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 in debug mode, the following errors happened: d:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\include\xdebug(29): error C2365: 'new' : redefinition; previous definition was a 'member function' d:\Program Files\Microsoft Visual Studio...
0
1986
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' comes, followed by the 64 bit compilation of the IDl file. The comlpilation goes thro' the full stage and then the StdAfx.cpp is compiled. I have another similar VC 6 COM dll code that gets compiled without invoking the 64 bit processing of the...
5
1457
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 wait 10-50% longer...
9
5527
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
9710
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10593
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10340
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10329
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9163
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5527
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5663
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4304
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3000
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.