![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Script for reading .csv file | creativeworld | Shell Programming and Scripting | 3 | 11-12-2007 02:47 AM |
| Script for Reading a Password file | srirams | Shell Programming and Scripting | 2 | 03-07-2007 10:20 AM |
| Script for reading an input file | gzs553 | Shell Programming and Scripting | 1 | 10-17-2006 07:55 AM |
| Reading file names from a file and executing the relative file from shell script | anushilrai | Shell Programming and Scripting | 4 | 03-10-2006 05:25 AM |
| script to reading a file | vasikaran | UNIX for Dummies Questions & Answers | 3 | 07-26-2005 06:28 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Reading a file into a C++ script
Hi,
I'm trying to read a file in with and assigne the stream to a char * type. I've manged it using the cin.get returning type char, but am having run-time problems returning a char *. For example, char *pStream = "file.txt"; ifstream from(pStream); from.open(pStream); cin.get(pStream, FileSize, '\n'); However, the pStream in cin.get(pStream, FileSize, '\n'); does not seem to work at run-time, as it just hangs. Txs ![]() |
|
||||
|
Ive sorted this now -
char *pStream = new char[200]; char *pFile = "file.txt"; ifstream is(pFile); if(!is) error("Cannot open File", pFile); if(is.good()) { while(is.get(pStream, 200, EOF)) the problem was that you can't call the ifstream constructor twice ie is.open(pFile) and is.get(pStream)!! ![]() |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|