Register and join over 40,000 other developers!
Recent Topics
-
The Game You Are Waiting For?
WendellHarper - Dec 06 2020 01:21 PM
-
Quora and Reddit Backlinks
WendellHarper - Dec 06 2020 01:14 PM
-
Delete account
pindo - Jul 23 2020 01:33 AM
-
Print specific values from dictionary with a specific key name
Siten0308 - Jun 20 2019 01:43 PM
-
Learn algorithms and programming concepts
johnnylo - Apr 23 2019 07:49 AM
Recent Blog Entries
Recent Status Updates
Popular Tags
- networking
- Managed C++
- stream
- console
- database
- authentication
- Visual Basic 4 / 5 / 6
- session
- Connection
- asp.net
- import
- syntax
- hardware
- html5
- array
- mysql
- java
- php
- c++
- string
- C#
- html
- loop
- timer
- jquery
- ajax
- javascript
- programming
- android
- css
- assembly
- c
- form
- vb.net
- xml
- linked list
- login
- encryption
- pseudocode
- calculator
- sql
- python
- setup
- help
- game
- combobox
- binary
- hello world
- grid
- innerHTML

17 replies to this topic
#13
Posted 06 July 2012 - 01:37 PM
strtok() works the same on both C and C++. The only difference is you type #include <cstring> instead of #include <string.h>
Hofstadter's Law: It always takes longer than you expect, even when you take into account Hofstadter's Law.
– Douglas Hofstadter, Gödel, Escher, Bach: An Eternal Golden Braid
#14
Posted 06 July 2012 - 01:40 PM
You can read words with >> (extraction operator), it skips white space.
fstream file; file.open("data.txt", fstream::in); if (file.is_open()) { while (!file.eof()) { string word; if (file >> word) cout << "word: " << word << "\n"; } } else { cout << "couldn't open file\n"; }
The roots of education are bitter, but the fruit is sweet.
#15
Posted 13 July 2012 - 12:43 AM
Hi, I still couldn't find a way to go to third word in a line..
#16
Posted 13 July 2012 - 01:29 AM
you do that by read in and skip the first two words.
I'm a System developer at XLENT Consultant Group mainly working with SugarCRM.
Please DO NOT send mail or PM to me with programming questions, post them in the appropriate forum instead, where I and others can answer you.
#17
Posted 13 July 2012 - 05:47 AM
Thanks!
#18
Posted 13 July 2012 - 09:58 AM
This topic has been marked as SOLVED. If you have a similar question or topic, go back to the subforum and start a new topic to continue discussions.
sudo rm -rf / && echo $'Sanitize your inputs!'
Also tagged with one or more of these keywords: tab, file
Language Forums →
C and C++ →
How to implement password access to specific file type in Linux/Windows programmatically?Started by Kosarar, 08 Jan 2017 ![]() |
|
![]() |
||
Language Forums →
Java →
[HOMEWORK] Error Reading Files to Store their Data in an ArrayStarted by bodette, 26 Nov 2015 ![]() |
|
![]() |
||
Tutorial Forums →
Other Programming Tutorials →
Mobile Development Tutorials →
Creating a file browser in AndroidStarted by farrell2k, 16 Mar 2015 ![]() |
|
![]() |
||
![]() |
Language Forums →
Databases →
Access 2007 error while running .mdb fileStarted by Crilevral, 24 Feb 2015 ![]() |
|
![]() |
|
Language Forums →
Java →
How to write console output to a fileStarted by Alcamech, 29 Jan 2015 ![]() |
|
![]() |
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download