Re: [OT] C++ programming: keeping count of data items read from file

2008-05-13 Thread Michelle Konzack
Am 2008-05-06 20:56:09, schrieb Jordi Gutiérrez Hermoso: Although it's true that sometimes the C++ Hello World seems bloated to the C Hello World, the difference becomes negligible in any project of considerable size beyond Hello World. Embedded devices may be a different thing, and I

Re: [OT] C++ programming: keeping count of data items read from file

2008-05-10 Thread Ron Johnson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 05/09/08 22:47, H.S. wrote: s. keeling wrote: That's almost trivial. The datasets you see in the petrochemical industry can be in the terabyte range. They're so big, they have to edit in place, not write another output file. perl handles

Re: [OT] C++ programming: keeping count of data items read from file

2008-05-10 Thread Chris Bannister
On Sat, May 10, 2008 at 08:35:25AM -0500, Ron Johnson wrote: Maybe. What I do know is that Perl's regex functionality has been *highly* optimized over the years. So, if the task is pattern matching over large datasets, Perl is the language to use, even over compiled languages. Take a look

Re: [OT] C++ programming: keeping count of data items read from file

2008-05-10 Thread Ron Johnson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 05/10/08 10:25, Chris Bannister wrote: On Sat, May 10, 2008 at 08:35:25AM -0500, Ron Johnson wrote: Maybe. What I do know is that Perl's regex functionality has been *highly* optimized over the years. So, if the task is pattern matching over

Re: [OT] C++ programming: keeping count of data items read from file

2008-05-09 Thread Ron Johnson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 05/08/08 21:32, H.S. wrote: s. keeling wrote: [snip] Man, does C++ produce ugly, obtuse code (no offence meant to C++ code posters; thanks), and this from a perl programmer. The problem may be quite trivial in the languages you mention as far

Re: [OT] C++ programming: keeping count of data items read from file

2008-05-09 Thread Jordi Gutiérrez Hermoso
On 09/05/2008, Ron Johnson [EMAIL PROTECTED] wrote: Remember, there's developer scale as well as execution scale. The execution scale is all that matters to us, since a wrong algorithm or language can easily exacerbate execution times by orders of magnitude, while developer time hardly ever

Re: [OT] C++ programming: keeping count of data items read from file

2008-05-09 Thread Ron Johnson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 05/09/08 08:19, Jordi Gutiérrez Hermoso wrote: On 09/05/2008, Ron Johnson [EMAIL PROTECTED] wrote: Remember, there's developer scale as well as execution scale. The execution scale is all that matters to us, since a wrong algorithm or

Re: [OT] C++ programming: keeping count of data items read from file

2008-05-09 Thread Jordi Gutiérrez Hermoso
On 09/05/2008, Ron Johnson [EMAIL PROTECTED] wrote: Then write your apps in FORTRAN. (But then, you aren't the OP...) Sometimes I do, as a matter of fact, but I feel more comfortable with C++. You're not going to convince a numericist to give up compiled languages. :-) Give it up. I'm

Re: [OT] C++ programming: keeping count of data items read from file

2008-05-09 Thread s. keeling
H.S. [EMAIL PROTECTED]: s. keeling wrote: Ron Johnson [EMAIL PROTECTED]: Sorry. It just seems (to an old C programmer) that this is pretty simple problem, unless there's some tricky detail that you aren't telling us. That's exactly what I was thinking looking at the problem. No

Re: [OT] C++ programming: keeping count of data items read from file

2008-05-09 Thread H.S.
s. keeling wrote: Yes, and you need to do more research. and I skipped some other factors as well which contributed to not using an interpreted language. Perhaps in my next project, I will see how that goes. For this one, I am using bash, sed, perl and awk and gnuplot for post processing

Re: [OT] C++ programming: keeping count of data items read from file

2008-05-09 Thread H.S.
s. keeling wrote: That's almost trivial. The datasets you see in the petrochemical industry can be in the terabyte range. They're so big, they have to edit in place, not write another output file. perl handles even this well. I/O performance is pretty much hardware bound. This is binary

Re: [OT] C++ programming: keeping count of data items read from file

2008-05-08 Thread H.S.
James Allsopp wrote: hi, Try something like this, just add some pointers; scan is just a simple object and l is a class vector. HTH jim int nearest::readdata(std::string s, std::vectorscan l) { //read in scuba core list std::ifstream input(s.c_str()); std::string temp, pos, x ,y;

Re: [OT] C++ programming: keeping count of data items read from file

2008-05-08 Thread s. keeling
Ron Johnson [EMAIL PROTECTED]: On 05/06/08 13:25, H.S. wrote: Ron Johnson wrote: Is this a binary file or a text file? hmm. Text. I made it clear in the original post. Sorry. It just seems (to an old C programmer) that this is pretty simple problem, unless there's some tricky

Re: [OT] C++ programming: keeping count of data items read from file

2008-05-08 Thread Jordi Gutiérrez Hermoso
On 08/05/2008, s. keeling [EMAIL PROTECTED] wrote: Ron Johnson [EMAIL PROTECTED]: On 05/06/08 13:25, H.S. wrote: Ron Johnson wrote: Is this a binary file or a text file? hmm. Text. I made it clear in the original post. Sorry. It just seems (to an old C

Re: [OT] C++ programming: keeping count of data items read from file

2008-05-08 Thread H.S.
s. keeling wrote: Ron Johnson [EMAIL PROTECTED]: Sorry. It just seems (to an old C programmer) that this is pretty simple problem, unless there's some tricky detail that you aren't telling us. That's exactly what I was thinking looking at the problem. No offence None taken. meant to

Re: [OT] C++ programming: keeping count of data items read from file

2008-05-07 Thread Kevin B. McCarty
H.S. wrote: Michael Marsh wrote: Can you read full lines out into, eg, a stringstream, and parse your doubles out of that? You'd hit an EOF at the end of each line in that case. I'm not sure how you'd get stream out line-at-a-time, though there may be a stream operator

Re: [OT] C++ programming: keeping count of data items read from file

2008-05-06 Thread H.S.
Jordi Gutiérrez Hermoso wrote: On 06/05/2008, H.S. [EMAIL PROTECTED] wrote: In a C++ program I am reading a data file for later processing and computations. While reading that data file, I want to keep track of data items (doubles) read. Use std::list and other standard data structures. I

Re: [OT] C++ programming: keeping count of data items read from file

2008-05-06 Thread Robert Baron
On Tue, May 6, 2008 at 1:14 PM, H.S. [EMAIL PROTECTED] wrote: Jordi Gutiérrez Hermoso wrote: On 06/05/2008, H.S. [EMAIL PROTECTED] wrote: In a C++ program I am reading a data file for later processing and computations. While reading that data file, I want to keep track of data

Re: [OT] C++ programming: keeping count of data items read from file

2008-05-06 Thread H.S.
Robert Baron wrote: What is so terrible about counting the items as they come in? As I mentioned earlier, the issue is how do I count items read in one line, or before the next EOL? Counting total items is not a problem. Perhaps a different way to say this is, how do I detect if I have

Re: [OT] C++ programming: keeping count of data items read from file

2008-05-06 Thread Michael Marsh
On Tue, May 6, 2008 at 1:50 PM, H.S. [EMAIL PROTECTED] wrote: As I mentioned earlier, the issue is how do I count items read in one line, or before the next EOL? Counting total items is not a problem. Perhaps a different way to say this is, how do I detect if I have reached an EOL while

Re: [OT] C++ programming: keeping count of data items read from file

2008-05-06 Thread Ron Johnson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 05/06/08 12:50, H.S. wrote: Robert Baron wrote: What is so terrible about counting the items as they come in? As I mentioned earlier, the issue is how do I count items read in one line, or before the next EOL? Counting total items is not

Re: [OT] C++ programming: keeping count of data items read from file

2008-05-06 Thread H.S.
Michael Marsh wrote: On Tue, May 6, 2008 at 1:50 PM, H.S. [EMAIL PROTECTED] wrote: As I mentioned earlier, the issue is how do I count items read in one line, or before the next EOL? Counting total items is not a problem. Perhaps a different way to say this is, how do I detect if I have

Re: [OT] C++ programming: keeping count of data items read from file

2008-05-06 Thread Hal Vaughan
On Tuesday 06 May 2008, Ron Johnson wrote: On 05/06/08 12:50, H.S. wrote: Robert Baron wrote: What is so terrible about counting the items as they come in? As I mentioned earlier, the issue is how do I count items read in one line, or before the next EOL? Counting total items is not a

Re: [OT] C++ programming: keeping count of data items read from file

2008-05-06 Thread H.S.
Ron Johnson wrote: Is this a binary file or a text file? hmm. Text. I made it clear in the original post. -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]

Re: [OT] C++ programming: keeping count of data items read from file

2008-05-06 Thread Hal Vaughan
On Tuesday 06 May 2008, H.S. wrote: Ron Johnson wrote: Is this a binary file or a text file? hmm. Text. I made it clear in the original post. Ron has trouble keeping up with things like that. It's so hot where he lives his brain is often overheated with the lest bit of mental effort. Hal

Re: [OT] C++ programming: keeping count of data items read from file

2008-05-06 Thread H.S.
Hal Vaughan wrote: On Tuesday 06 May 2008, H.S. wrote: Ron Johnson wrote: Is this a binary file or a text file? hmm. Text. I made it clear in the original post. Ron has trouble keeping up with things like that. It's so hot where he lives his brain is often overheated with the lest bit of

Re: [OT] C++ programming: keeping count of data items read from file

2008-05-06 Thread Hal Vaughan
On Tuesday 06 May 2008, H.S. wrote: Hal Vaughan wrote: On Tuesday 06 May 2008, H.S. wrote: Ron Johnson wrote: Is this a binary file or a text file? hmm. Text. I made it clear in the original post. Ron has trouble keeping up with things like that. It's so hot where he lives his

Re: [OT] C++ programming: keeping count of data items read from file

2008-05-06 Thread James Allsopp
hi, Try something like this, just add some pointers; scan is just a simple object and l is a class vector. HTH jim int nearest::readdata(std::string s, std::vectorscan l) { //read in scuba core list std::ifstream input(s.c_str()); std::string temp, pos, x ,y; char * t;

Re: [OT] C++ programming: keeping count of data items read from file

2008-05-06 Thread Jordi Gutiérrez Hermoso
On 06/05/2008, H.S. [EMAIL PROTECTED] wrote: If you have visited that, it is full of people who want to discuss only the standard. The standard is nice. The standard is great. I love the standard. It can do everything, and when it can't, then you use Boost who does the rest. Wrapping other

Re: [OT] C++ programming: keeping count of data items read from file

2008-05-06 Thread Mark Allums
James Allsopp wrote: hi, Try something like this, just add some pointers; scan is just a simple object and l is a class vector. HTH jim int nearest::readdata(std::string s, std::vectorscan l) { //read in scuba core list std::ifstream input(s.c_str()); std::string temp, pos, x ,y;

Re: [OT] C++ programming: keeping count of data items read from file

2008-05-06 Thread Ron Johnson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 05/06/08 13:25, H.S. wrote: Ron Johnson wrote: Is this a binary file or a text file? hmm. Text. I made it clear in the original post. Sorry. It just seems (to an old C programmer) that this is pretty simple problem, unless there's some

Re: [OT] C++ programming: keeping count of data items read from file

2008-05-06 Thread H.S.
Jordi Gutiérrez Hermoso wrote: On 06/05/2008, H.S. [EMAIL PROTECTED] wrote: homebrewed subpar methods instead of standard C++. If you're going to be reading doubles one by one, and you want to store those doubles and know how many you have, I see little reason to not use an std::list From the

Re: [OT] C++ programming: keeping count of data items read from file

2008-05-06 Thread H.S.
Mark Allums wrote: (And is also an example of something that is wrong with the C++ standard library, when you need the c_str() member of string so often to get any real useful work done. Kind of defeats the purpose of having string in the first place.) Yes, that c_str() is a nuisance many

Re: [OT] C++ programming: keeping count of data items read from file

2008-05-06 Thread Mark Allums
Jordi Gutiérrez Hermoso wrote: On 06/05/2008, H.S. [EMAIL PROTECTED] wrote: Yup, that fscanf method looks interesting. I used that only when I program in C, but it might be judicious to use it in C++ in this situation. It's not. Streams are better and keep you away from nasty errors and

Re: [OT] C++ programming: keeping count of data items read from file

2008-05-06 Thread Jordi Gutiérrez Hermoso
On 06/05/2008, H.S. [EMAIL PROTECTED] wrote: APRACK FORTRAN library needs the input data in a 2D array (the arrays need to be arranged in column-major format). But, to answer your query, I don't *have* to read it in an array, I could read it in a list and then copy it to an array before I