| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
From txt file to array...c++ .net framework
i need some help in getting data from a txt file to an array. i'm using C++ in visual studio .net.
here's the txt file contents: A 75 83 77 91 76 B 80 90 95 93 48 C 78 81 11 90 73 D 92 83 30 69 87 E 23 45 96 38 59 F 60 85 45 39 67 G 27 31 52 74 83 H 93 94 89 77 97 I 79 85 28 93 82 J 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: Code:
IO::StreamReader *inData;
inData = IO::File::OpenText("InData.txt");
while (inData->Peek() != -1)
{
record = inFile->ReadLine();
}
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. sorry for the nonstandard code... K |
|
#2
|
|||
|
|||
|
I have a really similar problem... did anyone figure out how to fix it? I need to get numbers from a text file into an array and they have to be float kind. I don't know how to open the file or read the numbers in and I've tried all the help the program will give me. Does anyone know how to do this?hey6you
|
|
#3
|
|||
|
|||
|
Does it have to be a c++ stream solution or would a c version do for you? Also is the format of the text file guaranteed or do you need to error check it as you go?
-KM- |
![]() |
| Viewing: Dev Articles Community Forums > Programming > C/C++ Help > From txt file to array...c++ .net framework |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|