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

reading a Text-File into Vector of Strings

This is the partial-program i wrote, as usual, i ran into problems
halfway:
/* C++ Primer - 4/e
*
* Exercise 8.9
* STATEMENT:
* write a function to open a file for input and then read its
coontents into a vector of strings, storinig each line as separate
element in vector.
*
*/
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
/* using Pointers because 1st argument is an input file-stream and
for 2nd argument i want to take the original vector, not the copied
one.

next line is the source of error, line #22 */
void read_file( ifstream* my_file, std::vector<std::string>* svec )
{
ifstream infile;
infile.open("my_file");

/* Process File
Here
*/
}
int main()
{
std::vector<std::stringsvec;
std::vector<std::string>* psvec;

std::cout << "Enter the full Path to file: "; ifstream my_file;
ifstream* p_my_file;

std::cin >p_my_file;

read_file( p_my_file, psvec );

return 0;
}

-------- OUTPUT --------------
[arnuld@Arch64 c++]$ g++ -ansi -pedantic -Wall -Wextra ex_08-09.cpp
ex_08-09.cpp:22: error: variable or field ‘read_file’ declared void
ex_08-09.cpp:22: error: ‘ifstream’ was not declared in this scope
ex_08-09.cpp:22: error: ‘my_file’ was not declared in this scope
ex_08-09.cpp:22: error: expected primary-expression before ‘*’ token
ex_08-09.cpp:22: error: 'svec' was not declared in this scope
ex_08-09.cpp: In function 'int main()':
ex_08-09.cpp:39: error: 'ifstream' was not declared in this scope
ex_08-09.cpp:39: error: expected `;' before ‘my_file’
ex_08-09.cpp:40: error: 'p_my_file' was not declared in this scope
ex_08-09.cpp:44: error: 'read_file' was not declared in this scope
[arnuld@Arch64 c++]$
Opening the file is the 1st stage of the problem. 2nd stage will include
copying the each line as a library string into the vector. I am facing
problems at very 1st stage.

--
http://lispmachine.wordpress.com

Sep 13 '07 #1
15 5839

"arnuld" <ge*********@gmail.comwrote in message
news:pa****************************@gmail.com...
This is the partial-program i wrote, as usual, i ran into problems
halfway:
/* C++ Primer - 4/e
*
* Exercise 8.9
* STATEMENT:
* write a function to open a file for input and then read its
coontents into a vector of strings, storinig each line as separate
element in vector.
*
*/
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
/* using Pointers because 1st argument is an input file-stream and
for 2nd argument i want to take the original vector, not the copied
one.

next line is the source of error, line #22 */
void read_file( ifstream* my_file, std::vector<std::string>* svec )
{
ifstream infile;
infile.open("my_file");

/* Process File
Here
*/
}
Your function is a bit strange. If the first arg is an input
file stream, why aren't you using it?
You create a new ifstream and call open with a file name?
Maybe you just want to pass the file name to the function.
Or do you want the stream to stay open after this function
finishes?

Also, you don't need a pointer to your vector. Probably
better to pass it by reference.
>
int main()
{
std::vector<std::stringsvec;
std::vector<std::string>* psvec;

std::cout << "Enter the full Path to file: "; ifstream my_file;
ifstream* p_my_file;
Shouldn't ifstream be in the std namespace?
Sep 13 '07 #2
On 2007-09-13 13:11, arnuld wrote:
This is the partial-program i wrote, as usual, i ran into problems
halfway:
/* C++ Primer - 4/e
*
* Exercise 8.9
* STATEMENT:
* write a function to open a file for input and then read its
coontents into a vector of strings, storinig each line as separate
element in vector.
*
*/
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
/* using Pointers because 1st argument is an input file-stream and
for 2nd argument i want to take the original vector, not the copied
one.

next line is the source of error, line #22 */
void read_file( ifstream* my_file, std::vector<std::string>* svec )
void read_file(std::istream& my_file, std::vector<std::string>& vec)

For these kinds of things (passing the actual object and not a copy) a
reference is preferable, unless you need to be able to pass NULL.
{
ifstream infile;
infile.open("my_file");
Looking at the code in main() it looks like the file should already be
open at this point.
>
/* Process File
Here
*/
Look into using std::getline() for reading the contents of the file.
}
int main()
{
std::vector<std::stringsvec;
std::vector<std::string>* psvec;

std::cout << "Enter the full Path to file: "; ifstream my_file;
ifstream* p_my_file;
Don't use a pointer, "ifstream my_file;" will do.
>
std::cin >p_my_file;
One problem with using the >operator here is that it will not allow
for filenames containing spaces (I seem to recall that you can set the
delimiter somehow to change this behaviour). I would use std::getline()
here too. One you have the filename use my_file.open() to open the file
(don't forget to check that it succeeded).
Opening the file is the 1st stage of the problem. 2nd stage will include
copying the each line as a library string into the vector. I am facing
problems at very 1st stage.
You should probably re-read the chapter about filestreams, opening them
are quite easy, you just use the filename as argument to the constructor
or use the open() function:

std::ifstream file("myfile.txt");

or

std::ifstream file;
file.open("myfile.txt");

--
Erik Wikström
Sep 13 '07 #3
In article <pa****************************@gmail.com>,
ge*********@gmail.com says...

[ ... ]
/* using Pointers because 1st argument is an input file-stream and
for 2nd argument i want to take the original vector, not the copied
one.
You probably don't want to use pointers here -- you almost certainly
want to use references instead. For reference (no pun intended) you
should virtually _always_ plan on passing any stream by reference.
next line is the source of error, line #22 */
void read_file( ifstream* my_file, std::vector<std::string>* svec )
That needs to be 'std::ifstream'.
ex_08-09.cpp:22: error: variable or field ?read_file? declared void
Without the 'std::' on the beginning, the compiler doesn't recognize
that 'ifstream' is supposed to be a type. It's trying to read it as a
value, so it thinks you have something like:

int x(1);

but it's telling you that you can't define a variable of type 'void'.

--
Later,
Jerry.

The universe is a figment of its own imagination.
Sep 13 '07 #4
"arnuld" <ge*********@gmail.comwrote in message
news:pa****************************@gmail.com...
This is the partial-program i wrote, as usual, i ran into problems
halfway:
/* C++ Primer - 4/e
*
* Exercise 8.9
* STATEMENT:
* write a function to open a file for input and then read its
coontents into a vector of strings, storinig each line as separate
element in vector.
*
*/
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
/* using Pointers because 1st argument is an input file-stream and
for 2nd argument i want to take the original vector, not the copied
one.

next line is the source of error, line #22 */
void read_file( ifstream* my_file, std::vector<std::string>* svec )
{
ifstream infile;
infile.open("my_file");

/* Process File
Here
*/
}
int main()
{
std::vector<std::stringsvec;
std::vector<std::string>* psvec;

std::cout << "Enter the full Path to file: "; ifstream my_file;
ifstream* p_my_file;

std::cin >p_my_file;

read_file( p_my_file, psvec );

return 0;
}

-------- OUTPUT --------------
[arnuld@Arch64 c++]$ g++ -ansi -pedantic -Wall -Wextra ex_08-09.cpp
ex_08-09.cpp:22: error: variable or field 'read_file' declared void
ex_08-09.cpp:22: error: 'ifstream' was not declared in this scope
ex_08-09.cpp:22: error: 'my_file' was not declared in this scope
ex_08-09.cpp:22: error: expected primary-expression before '*' token
ex_08-09.cpp:22: error: 'svec' was not declared in this scope
ex_08-09.cpp: In function 'int main()':
ex_08-09.cpp:39: error: 'ifstream' was not declared in this scope
ex_08-09.cpp:39: error: expected `;' before 'my_file'
ex_08-09.cpp:40: error: 'p_my_file' was not declared in this scope
ex_08-09.cpp:44: error: 'read_file' was not declared in this scope
[arnuld@Arch64 c++]$
Opening the file is the 1st stage of the problem. 2nd stage will include
copying the each line as a library string into the vector. I am facing
problems at very 1st stage.
Output of the following program on my system is:
Enter the full Path to file: c:\alcsetup.log
[ResponseResult]
ResultCode=0

#include <iostream>
#include <fstream>
#include <vector>
#include <string>

void read_file( std::ifstream& my_file, std::vector<std::string>& svec )
{
std::string Line;
while ( std::getline( my_file, Line ) )
svec.push_back( Line );
}

int main()
{
std::vector<std::stringsvec;
std::cout << "Enter the full Path to file: ";
std::string FileName;
std::cin >FileName;
std::ifstream my_file( FileName.c_str() );
read_file( my_file, svec );

std::copy( svec.begin(), svec.end(),
std::ostream_iterator<std::string>(std::cout, "\n") );

return 0;
}
Sep 13 '07 #5
On Sep 13, 4:49 pm, Erik Wikström <Erik-wikst...@telia.comwrote:
>arnuld wrote:
void read_file(std::istream& my_file, std::vector<std::string>& vec)

For these kinds of things (passing the actual object and not a copy) a
reference is preferable, unless you need to be able to pass NULL.
ok

{
ifstream infile;
infile.open("my_file");
Looking at the code in main() it looks like the file should already be
open at this point.
:-\

/* Process File
Here
*/

Look into using std::getline() for reading the contents of the file.
got it.

std::cout << "Enter the full Path to file: "; ifstream my_file;
ifstream* p_my_file;

Don't use a pointer, "ifstream my_file;" will do.
you mean streams magically use references (stream name will be
implicitly converted to a reference ) ?

std::cin >p_my_file;

One problem with using the >operator here is that it will not allow
for filenames containing spaces (I seem to recall that you can set the
delimiter somehow to change this behaviour). I would use std::getline()
here too. One you have the filename use my_file.open() to open the file
(don't forget to check that it succeeded).
ok, done

You should probably re-read the chapter about filestreams, opening them
are quite easy, you just use the filename as argument to the constructor
or use the open() function:

std::ifstream file("myfile.txt");

or

std::ifstream file;
file.open("myfile.txt");
you want to say that fstream is like a library String ?

To manipulate the string 1st you have to create a String using:
std::string a_string;

looks like I have to treat an I/O Stream like a library String. I
thought I/O streams exist automatically, as this is the place where I
type program all the time, using Emacs.

Sep 13 '07 #6
On Sep 13, 6:22 pm, Jerry Coffin <jcof...@taeus.comwrote:
You probably don't want to use pointers here -- you almost certainly
want to use references instead. For reference (no pun intended) you
should virtually _always_ plan on passing any stream by reference.
ex_08-09.cpp:22: error: variable or field ?read_file? declared void

Without the 'std::' on the beginning, the compiler doesn't recognize
that 'ifstream' is supposed to be a type. It's trying to read it as a
value, so it thinks you have something like:

int x(1);

but it's telling you that you can't define a variable of type 'void'.
thanks Jerry, I learned 2 very-important things today :)

Sep 13 '07 #7
On 2007-09-13 18:58, arnuld wrote:
>On Sep 13, 4:49 pm, Erik Wikström <Erik-wikst...@telia.comwrote:
>>arnuld wrote:
> void read_file(std::istream& my_file, std::vector<std::string>& vec)

For these kinds of things (passing the actual object and not a copy) a
reference is preferable, unless you need to be able to pass NULL.

ok

{
ifstream infile;
infile.open("my_file");
>Looking at the code in main() it looks like the file should already be
open at this point.

:-\

/* Process File
Here
*/

Look into using std::getline() for reading the contents of the file.

got it.

std::cout << "Enter the full Path to file: "; ifstream my_file;
ifstream* p_my_file;

Don't use a pointer, "ifstream my_file;" will do.

you mean streams magically use references (stream name will be
implicitly converted to a reference ) ?
Not sure what you mean here. The reason you don't need a pointer is that
the lifetime of the istream is equal to the function in which is
declared (main()) so there's really no need to have it on the heap.
Allocating on the heap is usually only needed if the variable have a
lifetime incompatible with the lifetime of the scope in which it is
declared. This way you also don't have to worry about deleting it when
you are done with it.
std::cin >p_my_file;

One problem with using the >operator here is that it will not allow
for filenames containing spaces (I seem to recall that you can set the
delimiter somehow to change this behaviour). I would use std::getline()
here too. One you have the filename use my_file.open() to open the file
(don't forget to check that it succeeded).

ok, done

>You should probably re-read the chapter about filestreams, opening them
are quite easy, you just use the filename as argument to the constructor
or use the open() function:

std::ifstream file("myfile.txt");

or

std::ifstream file;
file.open("myfile.txt");

you want to say that fstream is like a library String ?

To manipulate the string 1st you have to create a String using:
std::string a_string;

looks like I have to treat an I/O Stream like a library String. I
thought I/O streams exist automatically, as this is the place where I
type program all the time, using Emacs.
ifstream is just another class in the library and have to be created
just like any other object. The only streams that do not have to be
created before use are std::cin, std::cout, std::cerr, and std::clog.

--
Erik Wikström
Sep 13 '07 #8

arnuld <ge*********@gmail.comwrote in message...
This is the partial-program i wrote, as usual, i ran into problems
halfway:

/* C++ Primer - 4/e * Exercise 8.9 * STATEMENT:
* write a function to open a file for input and then read its
coontents into a vector of strings, storinig each line as separate
element in vector.
*/

#include <iostream>
#include <fstream>
#include <vector>
#include <string>

/* using Pointers because 1st argument is an input file-stream and
for 2nd argument i want to take the original vector, not the copied
one. next line is the source of error, line #22 */
void read_file( ifstream* my_file, std::vector<std::string>* svec ){
ifstream infile;
infile.open("my_file");
/* Process File Here */
}
void read_file( std::string const &my_file, std::vector<std::string>
&svec ){
std::ifstream infile( my_file.c_str() );
if( not infile.is_open() ){ /* error */ }
/* Process File Here */
}
int main(){
std::vector<std::stringsvec;
// std::vector<std::string>* psvec;
>
std::cout << "Enter the full Path to file: "; ifstream my_file;
// ifstream* p_my_file;
// std::cin >p_my_file;

std::string p_my_file;
std::getline( std::cin, p_my_file );

// read_file( p_my_file, psvec );
read_file( p_my_file, svec );
return 0;
}
If you really did want to do what you were thinking, don't limit your
function.

void read_file( std::istream &in, std::vector<std::string&svec ){
// note: that is 'istream', not 'ifstream'.
for( std::string line; std::getline( in, line ); /*m_t*/ ){
svec.push_back( line );
} // for(line)
return;
} // read_file(istream&,vector<string>&)

int main(){
std::vector<std::stringsvec;
std::ifstream infile( "MyFile.txt" );
std::istringstream instring( "This will \n simulate \n" ); // <sstream>

read_file( infile, svec );
read_file( instring, svec );
std::cout<<"Type in some lines"<<std::endl;

/* I'll leave it to you to figure a way to invoke/terminate
input on this one <G>*/
/* hint: ctrl-Z, ctrl-C, [return], as-is, ??? */
read_file( std::cin, svec );

std::copy( svec.begin(), svec.end(),
std::ostream_iterator<std::string>( std::cout, "\n" ) );

return 0;
} // main()

Don't complicate your programming with pointers, unless you are *forced* to.
:-}

--
Bob R
POVrookie
Sep 13 '07 #9
On Sep 13, 11:19 pm, Juha Nieminen <nos...@thanks.invalidwrote:
I feel from your code that you lack basic understanding of C++ types,
pointers, and how they work and are used.

I wonder if you even understand what "ifstream" is and what
"ifstream*" means.

In that function you create a new ifstream and then open it,
suspiciously with the same name as your first function parameter, ie.
"my_file". This makes me suspect that you think that you are opening
that "file" represented by the first function parameter, called
"my_file", by giving the name of that variable, as a string none the
less, to a second ifstream.

The variable named my_file and the string "my_file" have *nothing*
to do with each other. They have absolutely no relation. One is a
variable (in this case of type "pointer-to-ifstream") and the other is
a string literal. Just because the string literal has the same
characters as the name of that variable don't make them related in any way.

Just the fact that you seem to try to be opening an ifstream with
another ifstream seems to show that you don't really understand what the
ifstream class is.
thanks for a lengthy explanation , finally i got it :)

For example, let's assume we have somewhere a function like this:

void foo(std::vector<std::string>& aVector) { ... }

This takes a vector as reference. In other words, a copy of the vector
is *not* given to this function when it's called, but instead just a
reference to the original vector. (You can think of references as
limited pointers.)

Somewhere else you could write this:

std::vector<std::stringmyVector;
foo(myVector);

The first line creates an vector, and the second line calls the foo()
function giving that vector as parameter. But as already seen, the
function doesn't actually take a copy of the vector, but a reference to
it, and thus any modification the function makes to that vector will be
done to the 'myVector' vector.

You could, of course, pass a pointer to your original vector too
(although a reference is usually recommended). In that case you make the
function to take a pointer:

void foo(std::vector<std::string>* aVector) { ... }

and then you can call it like this:

std::vector<std::stringmyVector;
foo(&myVector);

The & operator means "create a pointer pointing to this variable".
Thus the foo() function is given a pointer to 'myVector', and if foo()
modifies the vector behind the pointer, 'myVector' will be modified.

In neither case you need to explicitly create a pointer variable,
like you did. (And even if you created one, you would have to,
naturally, make it point somewhere and not leave it uninitialized like
you did.)

I understood how to use pointer sand references.

std::vector<std::stringlines;
std::string line;

while(inputFileStream.good())
{
std::getline(inputFileStream, line);
lines.push_back(line);

}

That's it. It doesn't need to be more complicated than that.
exercise needs that "reading part" to be in a separate function and
that is what i tried to did again:

/* C++ Primer - 4/e
*
* Exercise 8.9
* STATEMENT:
* write a function to open a file for input and then read its
* coontents into a vector of strings, storinig each line as separate
* element in vector.
*
*/
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
void read_file( std::ifstream& my_file, std::vector<std::string>&
svec )
{
std::string a_line;
while( std::getline( my_file, a_line ))
{
svec.push_back( a_line );
}

}
int main()
{
std::vector<std::stringsvec;
/* std::vector<std::string>& ref_svec = svec; */

std::cout << "Enter the full Path to file: ";
std::string text_file;
std::cin >text_file;

/* std::ifstream infile_stream(text_file.c_str()); */

/* line# 40, this if condition is the source of error */
if ( std::ifstream infile_stream(text_file.c_str()) )
{
read_file( infile_stream, svec );
}
/* check the vector if it contains anything at all
std::copy( svec.begin(), svec.end(),
std::ostream_iterator<std::string>(std::cout, "\n")
);
*/

return 0;
}
----------- OUTPUT -------------------
~/programming/c++ $ g++ -ansi -pedantic -Wall -Wextra ex_08-09.cpp
ex_08-09.cpp: In function 'int main()':
ex_08-09.cpp:40: error: expected primary-expression before
'infile_stream'
ex_08-09.cpp:40: error: expected `)' before 'infile_stream'
ex_08-09.cpp:42: error: 'infile_stream' was not declared in this scope
~/programming/c++ $

Sep 14 '07 #10
On Sep 13, 8:35 pm, "Jim Langston" <tazmas...@rocketmail.comwrote:
Output of the following program on my system is:
Enter the full Path to file: c:\alcsetup.log
[ResponseResult]
ResultCode=0

#include <iostream>
#include <fstream>
#include <vector>
#include <string>

void read_file( std::ifstream& my_file, std::vector<std::string>& svec )
{
std::string Line;
while ( std::getline( my_file, Line ) )
svec.push_back( Line );

}

int main()
{
std::vector<std::stringsvec;
std::cout << "Enter the full Path to file: ";
std::string FileName;
std::cin >FileName;
std::ifstream my_file( FileName.c_str() );
read_file( my_file, svec );

std::copy( svec.begin(), svec.end(),
std::ostream_iterator<std::string>(std::cout, "\n") );

return 0;

}
Jim, this program,as it is, never compiles on my system: gcc 4.2.1 on
Arch x86_64 . i get this error: 'ostream_iterator' is not a member
of 'std'

I need to add #include <iteratorto make this program work.
Sep 14 '07 #11
On Fri, 14 Sep 2007 07:09:02 +0000, arnuld wrote:
.... [SNIPPED].........
----------- OUTPUT -------------------
~/programming/c++ $ g++ -ansi -pedantic -Wall -Wextra ex_08-09.cpp
ex_08-09.cpp: In function 'int main()':
ex_08-09.cpp:40: error: expected primary-expression before
'infile_stream'
ex_08-09.cpp:40: error: expected `)' before 'infile_stream'
ex_08-09.cpp:42: error: 'infile_stream' was not declared in this scope
~/programming/c++ $
OK, i got this program to work and it does what exactly the exercise wants
and I only did this change:
std::ifstream infile_stream( text_file.c_str() );
/* 1st check if file was even opened or not */
if( infile_stream.good() )
{
read_file( infile_stream, svec );
}
thanks Juha (for that ".good()", the child-class of <iostream:)
--
http://lispmachine.wordpress.com

Sep 14 '07 #12
arnuld wrote:
~/programming/c++ $ g++ -ansi -pedantic -Wall -Wextra ex_08-09.cpp
ex_08-09.cpp: In function 'int main()':
ex_08-09.cpp:40: error: expected primary-expression before
'infile_stream'
ex_08-09.cpp:40: error: expected `)' before 'infile_stream'
ex_08-09.cpp:42: error: 'infile_stream' was not declared in this scope
~/programming/c++ $
Even though the error messages are cryptic, try to examine the
line where the first error happens (the line number is given in the
error message). That's usually a very good hint of what's wrong.

That's the most basic method of removing errors: Examine the
*first* error message and try to resolve why it's happening, and
fix it (usually it's quite clear why it's happening). Don't worry
about the rest of the error messages. Recompile. If there are still
errors, reiterate the process.
Sep 14 '07 #13
On 2007-09-14 09:51, arnuld wrote:
>On Fri, 14 Sep 2007 07:09:02 +0000, arnuld wrote:
>.... [SNIPPED].........
>----------- OUTPUT -------------------
~/programming/c++ $ g++ -ansi -pedantic -Wall -Wextra ex_08-09.cpp
ex_08-09.cpp: In function 'int main()':
ex_08-09.cpp:40: error: expected primary-expression before
'infile_stream'
ex_08-09.cpp:40: error: expected `)' before 'infile_stream'
ex_08-09.cpp:42: error: 'infile_stream' was not declared in this scope
~/programming/c++ $

OK, i got this program to work and it does what exactly the exercise wants
and I only did this change:
std::ifstream infile_stream( text_file.c_str() );
/* 1st check if file was even opened or not */
if( infile_stream.good() )
{
read_file( infile_stream, svec );
}
thanks Juha (for that ".good()", the child-class of <iostream:)
good() is a member function of the stream, not a class.

PS. Your program does not work correctly with a file named "my file.txt"

--
Erik Wikström
Sep 14 '07 #14
On Sep 14, 2:06 pm, Erik Wikström <Erik-wikst...@telia.comwrote:
good() is a member function of the stream, not a class.
:-\

PS. Your program does not work correctly with a file named "my file.txt"
fixed

std::string text_file;
//std::cin >text_file;
std::getline( std::cin, text_file );

just changed the input method :)

Sep 14 '07 #15
"arnuld" <ge*********@gmail.comwrote in message
news:11**********************@22g2000hsm.googlegro ups.com...
>On Sep 13, 8:35 pm, "Jim Langston" <tazmas...@rocketmail.comwrote:
>Output of the following program on my system is:
Enter the full Path to file: c:\alcsetup.log
[ResponseResult]
ResultCode=0

#include <iostream>
#include <fstream>
#include <vector>
#include <string>

void read_file( std::ifstream& my_file, std::vector<std::string>& svec )
{
std::string Line;
while ( std::getline( my_file, Line ) )
svec.push_back( Line );

}

int main()
{
std::vector<std::stringsvec;
std::cout << "Enter the full Path to file: ";
std::string FileName;
std::cin >FileName;
std::ifstream my_file( FileName.c_str() );
read_file( my_file, svec );

std::copy( svec.begin(), svec.end(),
std::ostream_iterator<std::string>(std::cout, "\n") );

return 0;

}

Jim, this program,as it is, never compiles on my system: gcc 4.2.1 on
Arch x86_64 . i get this error: 'ostream_iterator' is not a member
of 'std'

I need to add #include <iteratorto make this program work.
Hmm.. all I can say is most likely one of my includes must include
<iteratorbecause it compiled on my compiler. But, yes, it can be a bit of
a pain to show code that won't compile on all implementations. I'll try to
remember to #include <iteratorin the future.
Sep 14 '07 #16

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

Similar topics

2
by: Dariusz | last post by:
Below is part of a code I have for a database. While the database table is created correctly (if it doesn't exist), and data is input correctly into the database when executed, I have a problem...
1
by: Boris Wilhelms | last post by:
Hello all, at first, sorry for my bad English, I’ll give my best  We have a strange problem reading Text- and VarChar-Fields. Our configuration: -Windows 2003 Server -MySQL Server 3.23.36...
4
by: Luca | last post by:
Hello Everybody, I'm a 26 years old Italian "Florentine" Computer technician :) I'm writing you about an idea that I've got of a function that could be introduced in new web browsers (or even...
6
by: Eddie | last post by:
When I use JavaScript to read an element's textDecoration style, I only get one value even if there are more than one in the sytle sheet. For example if the text-decoration is defined as:...
4
by: Mateo | last post by:
Hi! I have labels on my page (some are web forms controls, and some are plain HTML labels), and I need Mozilla compatibile way for reading label value. For example, in IE I can use this:...
21
by: JoKur | last post by:
Hello, First let me tell you that I'm very new to C# and learning as I go. I'm trying to write a client application to communicate with a server (that I didn't write). Each message from the...
1
by: ChrisFrohlich | last post by:
ASP.NET 2.0 with Text DataTypes: I've got a similar question going in the SQL group, but I was wondering if anyone has successfully implemented reading/writing character data from a Text datatype...
6
by: John Wright | last post by:
I am trying to read the data from a device on a serial port. I connect just fine and can receive data fine in text mode but not in binary mode. In text mode the data from the device comes in...
4
by: alphatommy_at_hotmail_dot_com | last post by:
Hi, I need to read data coming from serial port of type ushort(16-bits, unfortunately this can not be changed). I have tried reading using ReadChar (32-bits) and ReadByte(8 bits) with no...
4
by: Shark | last post by:
Hi, I need a help. My application reads data from COM port, this data is then parsed and displyed on: 1. two plotters 2. text box. I'm using Invoke method to update UI when new data is...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...
0
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,...
0
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...
0
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...

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.