Thread: File I/O in MingW?

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    May 2005
    Posts
    41

    File I/O in MingW?

    Hello again, everyone.

    I'm currently developing a ASCII text file reader, to create my game in.

    So I went and found this tutorial.

    However, when I try to create my own program using either MingW or Dev C++, I get a heap of error messages like:

    Code:
    --------------------Configuration: Map_Scripter - Debug--------------------
    Compiling...
    main.cpp
    main.cpp: In function `int main(int, char**)':
    main.cpp:17: error: no match for 'operator>>' in 'banner >> title'
    C:\MinGWStudio\MinGW\bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\include\c++\3.4.2\bits\istream.tcc:87: note: candidates are: std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(std::basic_istream<_CharT, _Traits>&(*)(std::basic_istream<_CharT, _Traits>&)) [with _CharT = char, _Traits = std::char_traits<char>]
    C:\MinGWStudio\MinGW\bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\include\c++\3.4.2\bits\istream.tcc:93: note:                 std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(std::basic_ios<_CharT, _Traits>&(*)(std::basic_ios<_CharT, _Traits>&)) [with _CharT = char, _Traits = std::char_traits<char>]
    C:\MinGWStudio\MinGW\bin\..\lib\gcc\mingw32\3.4.2\..\..\..\..\include\c++\3.4.2\bits\istream.tcc:102: note:                 std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(std::ios_base&(*)(std::ios_base&)) [with _CharT = char, _Traits = std::char_traits<char>]
    I dont really understand these errors (not using functions correctly?) and was wondering if anyone know whats happening.

    So heres my source:
    Code:
    //Map scripter -an ASCII text interpruter, supposedly able to create ASCII games, 
    //I should probaly allow it to read binary files, to hard-code Vacuus
    #include <cstdio>
    #include <cstdlib>
    //Required for I/O:
    #include <fstream>
    
    using namespace std;
    //Prototypes
    char title[20][40]={' '}; //Title, to be read from ./data/title.txt
    ifstream banner("data\title.txt"); //Banner input, should be stored into title
    //I need to add the other prototypes for the reader to, this version is meant to just read the banner
    
    	
    int main(int argc, char *argv[])
    {
    	for ( int eY; eY < 20; eY++ )
    	{
            for ( int eX; eX < 40; eX++; )
    		{
    			banner >> title[eY][eX];
    		}
    	}
    	for (int y; y < 20; y++)
    	{
    		for (int x; x < 40; x++)
    		{
    			cout<<title[y][x];
    		}
    	}
    	system("\nPAUSE");
    	return 0;
    }
    Thank you in advance
    Last edited by Nebbuchadnezzar; 07-17-2005 at 01:32 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Data Structure Eror
    By prominababy in forum C Programming
    Replies: 3
    Last Post: 01-06-2009, 09:35 AM
  2. File I/O Assertion Failure in VS2008
    By clegs in forum C Programming
    Replies: 5
    Last Post: 12-25-2008, 04:47 AM
  3. Game Pointer Trouble?
    By Drahcir in forum C Programming
    Replies: 8
    Last Post: 02-04-2006, 02:53 AM
  4. 2 questions surrounding an I/O file
    By Guti14 in forum C Programming
    Replies: 2
    Last Post: 08-30-2004, 11:21 PM
  5. advice on file i/o
    By Unregistered in forum C Programming
    Replies: 1
    Last Post: 11-29-2001, 05:56 AM