Thread: File IO - File creation

  1. #1
    Registered User
    Join Date
    Sep 2011

    File IO - File creation

    Hello forum members
    My goal with my code is to design a system of creating a series of XML files based on whether or not a specific XML file exists.

    int main(){
    int filename=0;
    ofstream fileobject("1.xml");
    cout << "The configuration files have already been created."<<"\n" ;      
    When I attempt to compile, I get these errors from the compiler (Dev-C++).
    " void value not ignored as it ought to be"
    " expected `)' before ';' token "
    "expected `;' before ')' token "

    Any help is appreciated!

  2. #2
    SAMARAS std10093's Avatar
    Join Date
    Jan 2011
    Nice, France
    line 4 if i remember well,function open has as return value nothing,thus void,so the compiler can not accept such a statement! Fix this and then the other two errors may go away.

    Tip:When you get a series of errors ,try fixing them from top!Because there is a big possibility that one or more errors which follow to be created by the errors that are on top!

  3. #3
    Registered User
    Join Date
    Oct 2006
    it appears that your understanding of basic C++ concepts is a bit lacking. in your program, "while" should be replaced with "for", and ofstream:: open does not return anything, so checking if it's equal to 1 is certainly going to be a problem (void value not ignored as it ought to be).

    also your indentation is nearly nonexistent. in Dev-C++ you have to TRY to make code that looks this bad.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. exe file creation using run prompt
    By siperi in forum C Programming
    Replies: 2
    Last Post: 03-20-2011, 09:29 AM
  2. Help on File Creation with Date...
    By mehuldoshi in forum C Programming
    Replies: 2
    Last Post: 07-29-2002, 01:28 AM
  3. Still need info about file creation
    By Lee the Weasle in forum C++ Programming
    Replies: 4
    Last Post: 05-23-2002, 08:12 PM
  4. File creation
    By Unregistered in forum A Brief History of
    Replies: 2
    Last Post: 04-18-2002, 08:36 PM
  5. *.dat file creation
    By Robert_Ingleby in forum C Programming
    Replies: 6
    Last Post: 03-07-2002, 05:32 PM