Skip to content

una-eif204-progra2-master/dataflow-textfiles-01

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Ejemplo de DataFlow con Archivos de Texto

El ejemplo se enfoca en crear un archivo de texto con los datos que estan definidos en el objeto persona.

Librerias utilizadas

  • fstream: Input/output stream class to operate on files.

Write

// Create and open a text file
ofstream myFile(fileName, ios_base::app);
member constant opening mode
app (append) Set the stream's position indicator to the end of the stream before each output operation.
ate (at end) Set the stream's position indicator to the end of the stream on opening.
binary (binary) Consider stream as binary rather than text.
in (input) Allow input operations on the stream.
out (output) Allow output operations on the stream.
trunc (truncate) Any current content is discarded, assuming a length of zero on opening.

Read

Line By Line

// Use a while loop together with the getline() function to readByLine the file line by line
    while (getline (myReadFile, myTextLine)) {
        // Output the text from the file
        myText = myText + myTextLine + "\n\r";
    }

Full Content

    content.assign((istreambuf_iterator<char>(myReadFile)),
                   (istreambuf_iterator<char>()));

About

Basic example of Data Flow with Text Files

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published