C Board  

Go Back   C Board > General Programming Boards > C++ Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 12-02-2009, 05:59 AM   #1
Registered User
 
Join Date: Nov 2009
Posts: 14
from text file to array

Hello there, i'm writing a code of a program and i'm stuck with one thingy... i need to put the content of file to a char array... the content of file:
Code:
one(1) nine(9) five(5) two(2)
how do i put only the words in to a array...because later i will have to go through all of them and search for a particular word? any suggestions?
apisio is offline   Reply With Quote
Old 12-02-2009, 06:20 AM   #2
CSharpener
 
vart's Avatar
 
Join Date: Oct 2006
Posts: 5,556
Quote:
Originally Posted by apisio View Post
Hello there, i'm writing a code of a program and i'm stuck with one thingy... i need to put the content of file to a char array...
Why not to use vector of strings instead?
__________________
If I have eight hours for cutting wood, I spend six sharpening my axe.
vart is offline   Reply With Quote
Old 12-02-2009, 06:58 AM   #3
Registered User
 
Join Date: Nov 2009
Posts: 14
alright, how to i put it to a string then? will i have to change all the chars to strings?
apisio is offline   Reply With Quote
Old 12-02-2009, 07:34 AM   #4
CSharpener
 
vart's Avatar
 
Join Date: Oct 2006
Posts: 5,556
Quote:
Originally Posted by apisio View Post
alright, how to i put it to a string then? will i have to change all the chars to strings?
Have you read FAQ?

For example Cprogramming.com FAQ > Separate a string into tokens? (C++)
__________________
If I have eight hours for cutting wood, I spend six sharpening my axe.
vart is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
reading a string from a text file into a 2d array duelord C++ Programming 2 11-22-2009 07:29 AM
Basic text file encoder Abda92 C Programming 15 05-22-2007 01:19 PM
A bunch of Linker Errors... Junior89 Windows Programming 4 01-06-2006 02:59 PM
airport Log program using 3D linked List : problem reading from file gemini_shooter C Programming 3 03-04-2005 02:46 PM
simulate Grep command in Unix using C laxmi C Programming 6 05-10-2002 04:10 PM


All times are GMT -6. The time now is 12:19 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22