Click here to Skip to main content
15,891,864 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: this takes 40+ seconds on my machine.. what ? Pin
Ravi Bhavnani9-Mar-04 1:54
professionalRavi Bhavnani9-Mar-04 1:54 
AnswerRe: this takes 40+ seconds on my machine.. what ? Pin
Tim Smith9-Mar-04 4:18
Tim Smith9-Mar-04 4:18 
GeneralOO Design Problem Pin
Jun Misugi8-Mar-04 10:22
Jun Misugi8-Mar-04 10:22 
GeneralRe: OO Design Problem Pin
Jim Crafton8-Mar-04 10:55
Jim Crafton8-Mar-04 10:55 
GeneralRe: OO Design Problem Pin
Navin8-Mar-04 11:00
Navin8-Mar-04 11:00 
GeneralRe: OO Design Problem Pin
Jun Misugi8-Mar-04 11:07
Jun Misugi8-Mar-04 11:07 
GeneralMemory Deallocation problem Pin
gteichner8-Mar-04 9:38
gteichner8-Mar-04 9:38 
GeneralFrom txt file to array...c++ .net framework Pin
kfresh8-Mar-04 8:57
kfresh8-Mar-04 8:57 
i need some help in getting data from a txt file to an array. i'm using C++ in visual studio .net. and yes i'm a newbie and this is a homework assignment so please be easy on me hahaha...

here's the txt file contents:
75 83 77 91 76
80 90 95 93 48
78 81 11 90 73
92 83 30 69 87
23 45 96 38 59
60 85 45 39 67
27 31 52 74 83
93 94 89 77 97
79 85 28 93 82
85 72 49 75 63

i need to use the numbers in the file for calculations. here's part of my code using StreamReader to get the data from the txt file.

Code:
<br />
int main() <br />
{ <br />
   double average = 0.0; <br />
   int rows = 0; <br />
   int cols = 0; <br />
    <br />
   //declare streamreader <br />
   IO::StreamReader *inData; <br />
   inData = IO::File::OpenText("InData.txt"); <br />
<br />
   //reading records <br />
   while (inData->Peek()) <br />
   { <br />
   } <br />
   inData->Close(); <br />


this is where i get tripped up.. i'm unsure what i need to add to get that data into an array to do calculations. I know i still need to declare the array. i just need to know what do to in the while loop to get the data from the txt file into an array to do calculations. so i guess the data from the files also need to be converted to integers i guess right?

K
GeneralRe: From txt file to array...c++ .net framework Pin
Tom Larsen8-Mar-04 9:06
Tom Larsen8-Mar-04 9:06 
GeneralRe: From txt file to array...c++ .net framework Pin
David Crow8-Mar-04 9:16
David Crow8-Mar-04 9:16 
GeneralRe: From txt file to array...c++ .net framework Pin
Christian Graus8-Mar-04 10:44
protectorChristian Graus8-Mar-04 10:44 
GeneralRe: From txt file to array...c++ .net framework Pin
kfresh8-Mar-04 10:50
kfresh8-Mar-04 10:50 
GeneralRe: From txt file to array...c++ .net framework Pin
Christian Graus8-Mar-04 10:55
protectorChristian Graus8-Mar-04 10:55 
GeneralRe: From txt file to array...c++ .net framework Pin
kfresh8-Mar-04 10:57
kfresh8-Mar-04 10:57 
GeneralRe: From txt file to array...c++ .net framework Pin
Christian Graus8-Mar-04 11:05
protectorChristian Graus8-Mar-04 11:05 
GeneralINI file question Pin
Tom Wright8-Mar-04 8:57
Tom Wright8-Mar-04 8:57 
GeneralRe: INI file question Pin
David Crow8-Mar-04 9:00
David Crow8-Mar-04 9:00 
GeneralRe: INI file question Pin
Tom Wright8-Mar-04 9:12
Tom Wright8-Mar-04 9:12 
GeneralRe: INI file question Pin
David Crow8-Mar-04 9:20
David Crow8-Mar-04 9:20 
GeneralRe: INI file question Pin
Tom Wright8-Mar-04 9:22
Tom Wright8-Mar-04 9:22 
GeneralRe: INI file question Pin
Tom Wright8-Mar-04 10:16
Tom Wright8-Mar-04 10:16 
GeneralRe: INI file question Pin
David Crow9-Mar-04 1:58
David Crow9-Mar-04 1:58 
GeneralRe: INI file question Pin
Navin8-Mar-04 10:57
Navin8-Mar-04 10:57 
GeneralRe: INI file question Pin
David Crow9-Mar-04 2:13
David Crow9-Mar-04 2:13 
GeneralTransferring a BMP file on network Pin
prasadddeshpande8-Mar-04 8:09
prasadddeshpande8-Mar-04 8:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.