Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

please help me in understanding the output of the file read

Status
Not open for further replies.

syedshan

Advanced Member level 1
Joined
Feb 27, 2012
Messages
463
Helped
27
Reputation
54
Reaction score
26
Trophy points
1,308
Location
Jeonju, South Korea
Activity points
5,134
Hi all,

first of all please check the program, then I will share the output and confusion

Code:
using namespace std;

int main() {

 short int *num_ptr;

 ifstream myReadFile;
 myReadFile.open("filea.txt");
 
 if (myReadFile.is_open()) {
 while (!myReadFile.eof()) {
	 cout << myReadFile <<endl;
 }
 
}
 
 myReadFile.close();
return 0;
}

Now the file veeeery simple(for testing only, actual file has actual data).

But the output is as below image. Note that it runs continously, even though I have the eof function there and I have to stop it by pressing ctrl+c
The file is attached, (It has only 00's in itView attachment filea.txt
What I
Capture.JPG

- - - Updated - - -

Oh by the way,

the quesiotion is why such output, what I actually want to do is to read the whole file at once, then break it into the integer-16 bit and then send it to my FPGA, device, the actual file has 16-bit integer values( here represented as 000s only)
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top