C/C++ Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingC/C++ Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old March 7th, 2004, 01:36 PM
kfresh kfresh is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2003
Posts: 4 kfresh User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #2  
Old June 23rd, 2004, 04:59 PM
hey6you hey6you is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 1 hey6you User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Angry frustrated

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

Reply With Quote
  #3  
Old June 24th, 2004, 03:49 AM
kode_monkey kode_monkey is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 367 kode_monkey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 21 sec
Reputation Power: 6
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-

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingC/C++ Help > From txt file to array...c++ .net framework


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway