Click here to Skip to main content
15,886,919 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
Generalpredicate function Pin
User 98854-Feb-03 7:26
User 98854-Feb-03 7:26 
GeneralRe: predicate function Pin
Joaquín M López Muñoz4-Feb-03 7:49
Joaquín M López Muñoz4-Feb-03 7:49 
GeneralRe: predicate function Pin
User 98854-Feb-03 8:04
User 98854-Feb-03 8:04 
GeneralRe: predicate function Pin
User 98854-Feb-03 8:07
User 98854-Feb-03 8:07 
GeneralDelayed QueryInterface error Exception!!! Pin
EdgarBM4-Feb-03 1:34
EdgarBM4-Feb-03 1:34 
GeneralRe: Delayed QueryInterface error Exception!!! Pin
Stefan Pedersen4-Feb-03 3:01
Stefan Pedersen4-Feb-03 3:01 
GeneralRe: Delayed QueryInterface error Exception!!! Pin
EdgarBM9-Feb-03 21:38
EdgarBM9-Feb-03 21:38 
QuestionUsing STL input iterator reading from a file ?? Pin
George24-Feb-03 0:21
George24-Feb-03 0:21 
Hi, everyone!

I meet with the following errors when compiling the
following simple codes. My IDE is VC 6.0.

Here are the codes.

--------
#include <iterator>
#include <fstream>
#include <iostream>

using namespace std;

void main()
{
ifstream ifile ("c:\\file1.txt");

istream_iterator<int, ptrdiff_t=""> r (ifile);
istream_iterator<int, ptrdiff_t=""> s (ifile);

}
--------

Here are the errors.

--------
Compiling...
testSTL.cpp
C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\MyProjects\testSTL\testSTL.cpp(11) : error C2664: '__thiscall std::istream_iterator<int,int,struct std::char_traits<int=""> >::std::istream_iterator<int,int,struct std::char_traits<int=""> >(class std::basic_istrea
m<int,struct std::char_traits<int=""> > &)' : cannot convert parameter 1 from 'class std::basic_ifstream<char,struct std::char_traits<char=""> >' to 'class std::basic_istream<int,struct std::char_traits<int=""> > &'
A reference that is not to 'const' cannot be bound to a non-lvalue
C:\PROGRAM FILES\MICROSOFT VISUAL STUDIO\MyProjects\testSTL\testSTL.cpp(12) : error C2664: '__thiscall std::istream_iterator<int,int,struct std::char_traits<int=""> >::std::istream_iterator<int,int,struct std::char_traits<int=""> >(class std::basic_istrea
m<int,struct std::char_traits<int=""> > &)' : cannot convert parameter 1 from 'class std::basic_ifstream<char,struct std::char_traits<char=""> >' to 'class std::basic_istream<int,struct std::char_traits<int=""> > &'
A reference that is not to 'const' cannot be bound to a non-lvalue
Error executing cl.exe.

testSTL.obj - 2 error(s), 0 warning(s)
--------

How to resolve the trouble?


Thanks in advance,
George
AnswerRe: Using STL input iterator reading from a file ?? Pin
Joaquín M López Muñoz4-Feb-03 1:40
Joaquín M López Muñoz4-Feb-03 1:40 
GeneralRe: Using STL input iterator reading from a file ?? Pin
George24-Feb-03 1:47
George24-Feb-03 1:47 
GeneralRe: Using STL input iterator reading from a file ?? Pin
Joaquín M López Muñoz4-Feb-03 1:50
Joaquín M López Muñoz4-Feb-03 1:50 
GeneralRe: Using STL input iterator reading from a file ?? Pin
George24-Feb-03 2:12
George24-Feb-03 2:12 
GeneralRe: Using STL input iterator reading from a file ?? Pin
Joaquín M López Muñoz4-Feb-03 2:15
Joaquín M López Muñoz4-Feb-03 2:15 
GeneralRe: Using STL input iterator reading from a file ?? Pin
George24-Feb-03 2:33
George24-Feb-03 2:33 
GeneralRe: Using STL input iterator reading from a file ?? Pin
Joaquín M López Muñoz4-Feb-03 4:22
Joaquín M López Muñoz4-Feb-03 4:22 
GeneralRe: Using STL input iterator reading from a file ?? Pin
George24-Feb-03 6:05
George24-Feb-03 6:05 
GeneralQuestion about STL output iterator. Pin
George23-Feb-03 22:24
George23-Feb-03 22:24 
GeneralRe: Question about STL output iterator. Pin
Joaquín M López Muñoz3-Feb-03 23:02
Joaquín M López Muñoz3-Feb-03 23:02 
GeneralRe: Question about STL output iterator. Pin
George24-Feb-03 0:11
George24-Feb-03 0:11 
GeneralRe: Question about STL output iterator. Pin
Joaquín M López Muñoz4-Feb-03 1:29
Joaquín M López Muñoz4-Feb-03 1:29 
GeneralRe: Question about STL output iterator. Pin
George24-Feb-03 1:44
George24-Feb-03 1:44 
GeneralRe: Question about STL output iterator. Pin
George24-Feb-03 0:49
George24-Feb-03 0:49 
GeneralMeeting troubles when compiling simple STL program. Pin
George23-Feb-03 17:35
George23-Feb-03 17:35 
GeneralRe: Meeting troubles when compiling simple STL program. Pin
Michael Dunn3-Feb-03 19:56
sitebuilderMichael Dunn3-Feb-03 19:56 
GeneralRe: Meeting troubles when compiling simple STL program. Pin
George23-Feb-03 22:21
George23-Feb-03 22:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.