Menu

fstream, ifstream, ofstream

2004-10-06
2012-09-26
  • Nobody/Anonymous

    I'm having problems getting these to work in this ide. Is there something wrong? Or is it me. They work fine in another ide.
    thanks.

     
    • Wayne Keen

      Wayne Keen - 2004-10-06

      Can you give us an idea what the specific problem is? You really have given us nothing to go on. In particular, whenever you ask a question, always include the "basic 3"

      (1) What version of Dev are you using (hint version number, not newest)
      (2) Provide a simple as possible example program that shows the effect you are seeing
      (3) Post your full compile log. Its on the tab labeled "Compile Log", the right mouse button must be used to bring up the copy menu.

      Remember one other thing. An IDE is just a fancy editor. Nothing more. It is the compiler that is the key to what compiles how.

      Wayne

       
    • Nobody/Anonymous

      1. version 4.9.9.0
      2. include <iostream>

      include <fstream>

      using namespace std;

      int main()
      {
      ofstream outfile;
      outfile.open("students.dat",ios::binary | ios::app);

          return 0;
      }
      
      1. Compiler: Default compiler
        Building Makefile: "C:\Dev-Cpp\Makefile.win"
        Executing make...
        make.exe -f "C:\Dev-Cpp\Makefile.win" all
        g++.exe -c Templates/project3stuff.cpp -o Templates/project3stuff.o -I"C:/DEV-CPP/include/c++/3.3.1" -I"C:/DEV-CPP/include/c++/3.3.1/mingw32" -I"C:/DEV-CPP/include/c++/3.3.1/backward" -I"C:/DEV-CPP/lib/gcc-lib/mingw32/3.3.1/include" -I"C:/DEV-CPP/include"

      Templates/project3stuff.cpp:4:2: invalid preprocessing directive #using
      Templates/project3stuff.cpp: In function int main()': Templates/project3stuff.cpp:8: error:ofstream' undeclared (first use this
      function)

      Templates/project3stuff.cpp:8: error: (Each undeclared identifier is reported

      only once for each function it appears in.)

      Templates/project3stuff.cpp:8: error: syntax error before ;' token Templates/project3stuff.cpp:9: error:outfile' undeclared (first use this
      function)

      Templates/project3stuff.cpp:9: error: ios' undeclared (first use this function) Templates/project3stuff.cpp:9: error: syntax error before::' token

      Execution terminated

       
    • Nobody/Anonymous

      I found the errors. Must be tired. Time to quit. Thanks anyway.

       
    • Wayne Keen

      Wayne Keen - 2004-10-06

      Cool, we all make mistakes...just keep in mind what I said about giving the basic information with your question...otherwise its like calling a mechanic and saying "My car won't start, whats wrong with it"

      Wayne

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.