fstream writing to a file
I needed some help writing to a file using **fstream**. I can currently write using the fwrite method. But I wanted to cast the data type using fwrite and write using it

Below is what I am going so far:

    noOfRows = 700;
    noOfCols = 100
    array[0] = unsigned char [noOfRows * noOfCols]
    
    fstream fstreamFile;
    fstreamFile.open ("fstreamFile.txt", fstream::out);
    
    for(int i = 0; i < noOfRows; i++ )
    {
    fwrite(array[0]+(i*noOfRows), sizeOf(unsigned char), noOfCols, fwriteFile); // writes ok
    fstreamFile.write((char*) array[0]+(i*noOfCols), sizeof(unsigned char)); // doesn't write
    }

Can someone please tell me what I am doing incorrectly? I get no compile error, the file just is not being written into (I have created it from before hand).
fstream writing to a file
===

I needed some help writing to a file using **fstream**. I can currently write using the fwrite method. But I wanted to cast the data type using fwrite and write using it

Below is what I am going so far:

    noOfRows = 700;
    noOfCols = 100
    array[0] = unsigned char [noOfRows * noOfCols]
    
    fstream fstreamFile;
    fstreamFile.open ("fstreamFile.txt", fstream::out);
    
    for(int i = 0; i < noOfRows; i++ )
    {
    fwrite(array[0]+(i*noOfRows), sizeOf(unsigned char), noOfCols, fwriteFile); // writes ok
    fstreamFile.write((char*) array[0]+(i*noOfCols), sizeof(unsigned char)); // doesn't write
    }

Can someone please tell me what I am doing incorrectly? I get no compile error, the file just is not being written into (I have created it from before hand).