problem reading integers separated by commas with VC8

A

andreas.fabri

I have a problem reading integers separated by commas with VC8


This program:

___________________________
// read.C
#include <iostream>

int main()
{
int n;
std::cin >> n;

std::cout << "n = " << n << std::endl;
}
____________________________


and this input in a file data.txt:
__________________________
1,2
4
__________________________


and run like that: read.exe < data


produces as output

n = 2015115236


When adding a blank before the comma
everything is fine.

Is this a VC8 bug, or is this standard compliant
and Microsoft the spearhead of the compliance front.

andreas
 
V

Victor Bazarov

I have a problem reading integers separated by commas with VC8


This program:

___________________________
// read.C
#include <iostream>

int main()
{
int n;
std::cin >> n;

std::cout << "n = " << n << std::endl;
}
____________________________


and this input in a file data.txt:
__________________________
1,2
4
__________________________


and run like that: read.exe < data


produces as output

n = 2015115236


When adding a blank before the comma
everything is fine.

Is this a VC8 bug, or is this standard compliant
and Microsoft the spearhead of the compliance front.

Seems like a bug. Try posting to 'microsoft.public.vc.language', they can
help you find out if it's known and submit it to MS if it isn't.

V
 
T

Tilman Kuepper

Hello world,
I have a problem reading integers separated by commas with VC8
[...]

see the thread "locale and streams on VC8" in the
newsgroup comp.lang.c++.moderated (Dec 2005).
There was also a bugfix posted by Mr. Plauger.

Best regards,
Tilman
 
A

andreas.fabri

Hi,

can anybody confirm that this helps with

$ cl.exe -version
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.42
for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.


I gave it a try It didn't help me.

thanks a lot,

andreas
 
V

Victor Bazarov

can anybody confirm that this helps with

$ cl.exe -version
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.42
for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.


I gave it a try It didn't help me.

It helps if you fix _all_ cases and if you switch to using _static_
runtime library.

Please next time post compiler-specific questions to that compiler
newsgroup. For VC++ it's 'microsoft.public.vc.language'.

V
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top