473,789 Members | 2,740 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3222
an***********@g eometryfactory. 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.publ ic.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++.m oderated (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***********@g eometryfactory. 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.publ ic.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
3322
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 and return those rows where any of the integers in that field are in my array? For example suppose I did the following: arInts = array(2,4,6,8,10);
1
9757
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 control. It outputs all text fields surrounded by quotes, and all numeric fields w/o quotes. All fields are separated with commas. This has been working for 2 years, until today, when one of the data fields
8
3207
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 still get a DBNull value... I'm not able to figure this one out, any help would be appreciated. Here's my code : Dim ConnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & sPath & ";Extended...
7
2958
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 manipulate (and report on) members of the class. Interface consists of: - 5 private variables char author; char title; char code;
8
3111
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 vector. Then I am printing the vector. Here is the code I tried. #include <iostream> #include <sstream> #include <vector>
10
8358
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 delivery of Travis Oliphant's NumPy manual, I have a quick question (hopefully) regarding how to read in Fortran written data. The data files are not binary, but ASCII text files with no formatting and mixed data types (strings, integers,...
13
3601
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' code and i need to assign them to a 32 bit integer array.
41
2216
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 want is that when the user goes onto an addition function, they can type the integers separated by commas ie. 1,3,6,23,2
3
3186
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 separated by a tab then i need to make a function that will print out what was read then make a main that will use the first function that reads followed by the second function that will print
0
9666
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...
1
10139
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
9984
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9020
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...
1
7529
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6769
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5418
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...
1
4093
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
2909
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.