Visualizzazione dei risultati da 1 a 2 su 2
  1. #1
    Utente di HTML.it
    Registrato dal
    May 2008
    Messaggi
    475

    [C++] Errore a compile time nella creazione di una ofstream

    Ciao a tutti... non riesco a capire perchè questo codice non funzioni:

    codice:
    #include <iostream>
    #include <fstream>
    
    using namespace std;
    
    int main()
    {
        ofstream out("test", ios::out || ios::binary);
    
        return 0;
    }
    mi da un errore in compile time alla prima (ed unica riga), quella che crea la ofstream. Questo codice si trova pari pari nel relativo capitolo della C++ Beginner's Guide della Microsoft, e non so perchè non compili.

    L'errore che mi da è questo:

    codice:
    /home/michele/Scrivania/Test/main.cpp|8|error: no matching function for call to ‘std::basic_ofstream<char, std::char_traits<char> >::basic_ofstream(const char [5], bool)’|
    Uso Code::Blocks su Ubuntu 9.10.
    "Let him who has understanding reckon the number of the beast, for it is a human number.
    Its number is rw-rw-rw-."

  2. #2
    Utente di HTML.it
    Registrato dal
    May 2008
    Messaggi
    475
    ...Lasciamo stare va xD

    Ho copiato due pipe invece che 1. Chiedo umilmente venia. xD

    Problema risolto.

    "Let him who has understanding reckon the number of the beast, for it is a human number.
    Its number is rw-rw-rw-."

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.