473,387 Members | 1,798 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,387 software developers and data experts.

problem reading integers separated by commas with VC8


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

Mar 10 '06 #1
4 3162
an***********@geometryfactory.com wrote:
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
--
Please remove capital As from my address when replying by mail
Mar 10 '06 #2
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

Mar 10 '06 #3
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

Mar 10 '06 #4
an***********@geometryfactory.com wrote:
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
--
Please remove capital As from my address when replying by mail
Mar 10 '06 #5

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

Similar topics

3
by: Funnyweb | last post by:
I have a database table, which has field that could contain a single integer or a list of comma separated integers. Is it possible to match each row of that field against an array of integers...
1
by: DCM Fan | last post by:
Access 2K, SP3 on Windows 2K, SP4 All, I have an import spec set up with quoted Identifiers and comma-separated values. The text file is produced by a 3rd-party program of which I have no...
8
by: stephane8 | last post by:
I'm able to open and read my .csv file. But when the character "-" is in one of my fields (ex : 18802-002) I get a system.DBNull value ! Even if I edit the file with notepad and put "18802-002" I...
7
by: fakeprogress | last post by:
For a homework assignment in my Data Structures/C++ class, I have to create the interface and implementation for a class called Book, create objects within the class, and process transactions that...
8
by: dragoncoder | last post by:
Hi, I am just a newbie in STL and trying to learn istream_iterator. My problem is I want a program which will take a comma separated string from the command line, tokenize it and copies into a...
10
by: Tyler | last post by:
Hello All: After trying to find an open source alternative to Matlab (or IDL), I am currently getting acquainted with Python and, in particular SciPy, NumPy, and Matplotlib. While I await the...
13
by: rsk | last post by:
Hi Friends, My requirement is as follows; A file is consisting of data in hexadecimal format(i.e a 32 bit data for example like "0xdeadbeef"). I have to read each of such data into my 'c'...
41
by: CyBerFirEZ | last post by:
Hi, I have really searched my brain for a solution but i cant seem to find one, and I really need some code to help me. I can do something like: a + b = r; cout << r; but that is easy. What I...
3
by: Newbieprogrammer | last post by:
Hello i need to make a function that would read these two lines 111 2222 3333 4444 5555 6666 7777 8888 222 3333 4444 notice that sometimes they are separated by one space and sometimes...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...

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.