Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


Closed Thread
  Search this Thread
Old 12-10-2005, 02:03 PM   #1
LQ Newbie
Registered: Nov 2005
Posts: 4

Rep: Reputation: 0
Question C++: Save a table of numbers from a file to an array


I am a very new user of C++, so this is probably strikingly obvious but I've been stuck with it for a while.. Any help would be very much appreciated.

My programme is eventually to read a table of numbers (spatial data exported from a GIS) and do some calculations based on that information. I'm stuck at the reading the table bit.

I was trying to save all the data on an array, I'm not even sure that's possible, but I've tried:

#include <iostream>
#include <fstream>


using namespace std;


#define horizontal 163
#define vertical 195

int SPACE [horizontal] [vertical];

int map()
ifstream inmap;"datacommas.dat"); //open a .dat file where 163x195 datapoints are saved, separated by commas

inmap >> SPACE;


return 0;


int main()

return 0;

To which the g++ compiler comments:

(line where inmap >> SPACE is): no match for `std::ifstream& >> int[163][195]' operator
/usr/include/c++/3.2.2/bits/istream.tcc:83: candidates are:
std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT,
_Traits>&(*)(std::basic_istream<_CharT, _Traits>&)) [with _CharT = char,
_Traits = std::char_traits<char>]
std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT,
_Traits>&(*)(std::basic_ios<_CharT, _Traits>&)) [with _CharT = char, _Traits
= std::char_traits<char>]
[and goes on for ages]



Last edited by geodpsa; 12-10-2005 at 02:19 PM.
Old 12-10-2005, 03:55 PM   #2
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914
Please do not post the same thread in more than one forum. Picking the most relevant forum and posting it once there makes it easier for other members to help you and keeps the discussion all in one place.

In this case I've closed the older one because the dupe was
in the more appropriate forum.

Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to save routing table entries? drgowans Linux - Networking 7 02-26-2019 06:16 PM
Shell scripting - Adding many numbers in an array Stingreen Linux - General 2 10-25-2004 05:25 PM
numbers as file owners stabu Linux - General 3 04-27-2004 12:29 PM
Checking a file for numbers chrisk5527 Linux - General 1 09-12-2003 08:50 AM
file version numbers tjones11 Programming 2 03-15-2002 12:51 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:58 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration