Simple C++ question - diyAudio
Go Back   Home > Forums > General Interest > Everything Else

Everything Else Anything related to audio / video / electronics etc) BUT remember- we have many new forums where your thread may now fit! .... Parts, Equipment & Tools, Construction Tips, Software Tools......

Please consider donating to help us continue to serve you.

Ads on/off / Custom Title / More PMs / More album space / Advanced printing & mass image saving
Reply
 
Thread Tools Search this Thread
Old 28th May 2004, 03:59 PM   #1
diyAudio Member
 
annex666's Avatar
 
Join Date: Jul 2002
Location: England
Default Simple C++ question

I'm not sure this belongs here (if on the site at all), but I have a programming question.

Is there a standard c++ function to read tab-seperated files?

Cheers for looking
__________________
...if it ain't broke don't fix it - make it BETTER!
  Reply With Quote
Old 28th May 2004, 04:12 PM   #2
tiroth is offline tiroth  United States
diyAudio Member
 
Join Date: Dec 2001
Location: Pittsburgh, PA, USA
Haha. No, but it shouldn't be too hard unless you have outlandish requirements for the data structure you are building from the text. For string manipulation it is probably easiest to use Perl--you can probably read an entire file in and split it into arrays in a couple of lines.
  Reply With Quote
Old 28th May 2004, 04:23 PM   #3
andy_c is offline andy_c  United States
Banned
 
Join Date: Apr 2003
Default Re: Simple C++ question

Quote:
Originally posted by annex666
Is there a standard c++ function to read tab-seperated files?
Not directly. Here's how you might do this:

1) Use an ifstream file stream object and use its getline() function to get each line of the file into a character buffer.

2) Use the standard C function strtok() on the buffer, passing in "\t" as the delimiter. Each call to strtok() will put a null byte in the next occurrence of the tab character and return a pointer to the beginning the token.
  Reply With Quote
Old 28th May 2004, 04:30 PM   #4
DRC is offline DRC  United Kingdom
diyAudio Member
 
DRC's Avatar
 
Join Date: Jan 2003
Location: UK (south west)
Actually, there are no functions in C++ as there are no standard C++ function / class libraries (although there is a template library - STL - but not recomended for microsoft C++) !!

Dave
  Reply With Quote
Old 28th May 2004, 05:03 PM   #5
andy_c is offline andy_c  United States
Banned
 
Join Date: Apr 2003
Here's a book on the C++ standard library that I recommend very highly. It's really excellent.
http://www.amazon.com/exec/obidos/tg...glance&s=books
  Reply With Quote
Old 29th May 2004, 10:14 AM   #6
Jay is offline Jay  Indonesia
diyAudio Member
 
Join Date: Feb 2003
Location: Jakarta
Quote:
Originally posted by andy_c
It's really excellent.
Hmmm... excellent? I found that a book may be "excellent" to one reader, may be not to others, depending on the skill level of the reader, and preferency in learning strategies.

That is for beginners who need the book for learning. For experts, the book may only be needed for reference, and hence completeness is more important than structure.
  Reply With Quote
Old 29th May 2004, 10:46 AM   #7
diyAudio Member
 
Join Date: Sep 2002
Location: Sweden
Just for your info, the C++ standard (or more precisely the
draft version of it) is available on line at
ftp://ftp.research.att.com/dist/c++std/WP/CD2/
There are also plentiful of info on Stroustrups homepage
www.research.att.com/~bs/C++.html
  Reply With Quote
Old 30th May 2004, 01:50 AM   #8
andy_c is offline andy_c  United States
Banned
 
Join Date: Apr 2003
Quote:
Originally posted by Jay
That is for beginners who need the book for learning. For experts, the book may only be needed for reference, and hence completeness is more important than structure.
What specific complaints do you have about the book, and what would you recommend as an alternative?
  Reply With Quote
Old 31st May 2004, 03:03 AM   #9
Jay is offline Jay  Indonesia
diyAudio Member
 
Join Date: Feb 2003
Location: Jakarta
Quote:
Originally posted by andy_c
What specific complaints do you have about the book, and what would you recommend as an alternative?
I thought it was a "free" book like what Christer had posted. Didn't see the amazon. So I wouldn't easily be persuaded to buy even if it is highly recommended . Anyway, I prefer that kind of "C++ in One Night!"
  Reply With Quote

Reply


Hide this!Advertise here!
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
A simple question from a simple man. inteificio Solid State 5 17th October 2005 03:00 PM
Simple Question zeonrider Solid State 2 3rd October 2005 10:56 PM
Simple question... Quattor Solid State 7 23rd June 2004 05:41 PM
Simple answer required for a simple question... rabbitz Multi-Way 4 31st August 2003 10:05 AM
A Simple Question OMNIFEX Multi-Way 3 19th July 2003 08:11 PM


New To Site? Need Help?

All times are GMT. The time now is 08:24 PM.


vBulletin Optimisation provided by vB Optimise (Pro) - vBulletin Mods & Addons Copyright © 2014 DragonByte Technologies Ltd.
Copyright 1999-2014 diyAudio

Content Relevant URLs by vBSEO 3.3.2