473,287 Members | 1,435 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,287 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 3154
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...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
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: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
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...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
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)...

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.