![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| High Level Programming Post questions about C, C++, Java, SQL, and other programming languages here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Script for reading .csv file | creativeworld | Shell Programming and Scripting | 3 | 11-11-2007 11:47 PM |
| Script for Reading a Password file | srirams | Shell Programming and Scripting | 2 | 03-07-2007 07:20 AM |
| Script for reading an input file | gzs553 | Shell Programming and Scripting | 1 | 10-17-2006 03: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 02:25 AM |
| script to reading a file | vasikaran | UNIX for Dummies Questions & Answers | 3 | 07-26-2005 02:28 AM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
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 |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
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)!! |
|||
| Google The UNIX and Linux Forums |