|
||||||
| C and C++ C and C++ forum for discussing all forms of C except for C#. These languages are powerful low level languages used for creating Operating Systems, Device Drivers, compilers and much more. |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Display Modes |
|
|||
|
Hey im trying to read a text file to an array, but at the moment the array is just staying empty:
Code:
#include <iostream>
#include <fstream>
//This section of the code includes the libaries needed to run the program
using namespace std;
int main()
//This defines the main() function
{
char file[256];
char code[512];
ifstream inFile;
system("cls");
cout << " Code Breaker!\n" << endl;
cout << "Please enter the name and extension of the file you want to decode:\n" << endl;
cin.getline ( file, 256, '\n');
cout << "The name entered was :\n" << file << endl;
inFile.open(file);
if (!inFile) {
cerr << "Unable to open file";
exit(1);
}
inFile >> code[512];
cout << "This file contains the code:\n" << code << endl;
inFile.close();
return 0;
}
|
| Sponsored Links |
|
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Text file manipulation. | joe1986 | Python | 11 | 01-28-2008 01:10 AM |
| How to save the text in a text file ??? | kresh7 | Visual Basic Programming | 0 | 11-25-2007 11:30 AM |
| How to style fonts of a text in a simple page? | c0de | Tutorials | 3 | 09-15-2007 11:08 PM |
| Usage of array structures to increment letter instances of text | Yuriy M | C and C++ | 2 | 09-13-2007 11:49 AM |
| text file manipulations in vb6.0 | Ronin_paes | Visual Basic Programming | 3 | 06-11-2007 05:54 AM |
| WingedPanther | ........ | 2753.6 |
| Xav | ........ | 2704 |
| Brandon W | ........ | 1702.32 |
| John | ........ | 1207.73 |
| marwex89 | ........ | 1175.24 |
| morefood2001 | ........ | 966.05 |
| dcs | ........ | 655.75 |
| Steve.L | ........ | 475.59 |
| orjan | ........ | 418.58 |
| Aereshaa | ........ | 383.54 |