Go Back   PCMech Forums > Help & Discussion > Web Design / Development

Need Some Help? Type Your Keywords Here:

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 02-03-2007, 11:47 AM   #1
Member (10 bit)
 
faint545's Avatar
 
Join Date: Mar 2006
Location: Maryland
Posts: 550
Reading from file...

i understand how to read from a file and write to a file.. my question is, how do you read the contents of a file if there are white spaces? example.. i have a text file called test.txt with the content "TEST TEST" and i want to be able to read both words including the whitespace...

this is what i have so far.. after the last cout statement, i can't quite figure out how to output the contents in the same format.. if i do just cout << names; it'll just print "TEST"

Quote:
int main()
{
ifstream readFile;
readFile.open("test.txt");
char names[20];
cout << "Test file sucessfully opened.\n";
readFile >> names;
cout << "Test file sucessfully read.\n";
system("PAUSE");
return 0;
}
__________________
Kerberos2:
Corsair Obsidian 700D
ASUS M4A89TD
Radeon HD 5850
A-DATA 8GB DDR3 1333
AMD Phenom II x6 1055T @ 2.8GHz w/ Corsair H50
Corsair 850HX PSU
WD Blue 160GB 7200 RPM SATA HDD
WD Black 640GB 7200 RPM SATA HDD
ASUS DVD/CD Drive
faint545 is offline   Reply With Quote
Reply

Bookmarks

Still Need Help? Type Your Keywords Here:


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Focus or tracking error nokiafan05 Computer Hardware 0 02-15-2006 10:19 PM
memory toomyg Computer Hardware 2 04-23-2004 09:06 AM
Burrner randomly shooting duds - Please Help! Zac3010 Computer Hardware 18 04-20-2004 09:40 PM
Heres some Window Secrets Citron Windows Tips, Tricks, and Tweaks 22 01-12-2003 07:07 AM
virus newme2 Networking & Online Security 21 02-23-2002 11:52 PM


All times are GMT -5. The time now is 07:25 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 PL2