This is what it should be:
// The Two Files are here.
QString ticketName
= ticketComboBox
->currentText
();
QString fileName
= directoryComboBox
->currentText
();
// now put the two files together.
QFile prnFile
("out.prn");
return;
//first write the ticket
qint64 totalSize = ticket->size();
qint64 chunkSize = 2048; //you can increase it and decrease it as you will
char *readBuffer = new char[chunkSize];
while ( totalSize )
{
if( chunkSize > totalSize )
chunkSize = totalSize;
qint64 actuallyRead = ticket->read( readBuffer, chunkSize );
if( actuallyRead > 0 )
prnFile.write( readBuffer, actuallyRead );
else
break;
totalSize -= actuallyRead;
}
//Now Write the PDF file
qint64 ptotalSize = file->size();
qint64 pchunkSize = 2048; //you can increase it and decrease it as you will
char *preadBuffer = new char[pchunkSize];
while ( ptotalSize )
{
if( pchunkSize > ptotalSize )
pchunkSize = ptotalSize;
qint64 pactuallyRead = file->read( preadBuffer, pchunkSize );
if( pactuallyRead > 0 )
prnFile.write( preadBuffer, pactuallyRead );
else
break;
ptotalSize -= pactuallyRead;
}
// And when you're done:
delete[] preadBuffer;
prnFile.flush();
delete ticket;
delete file;
// The Two Files are here.
QString ticketName = ticketComboBox->currentText();
QFile *ticket = new QFile(ticketName, NULL);
ticket->open(QIODevice::ReadOnly);
QFileInfo ti( ticketName );
QString fileName = directoryComboBox->currentText();
QFile *file = new QFile(fileName, NULL);
file->open(QIODevice::ReadOnly);
QFileInfo fi( fileName );
// now put the two files together.
QFile prnFile("out.prn");
if (!outPrn.open(QIODevice::WriteOnly))
return;
//first write the ticket
qint64 totalSize = ticket->size();
qint64 chunkSize = 2048; //you can increase it and decrease it as you will
char *readBuffer = new char[chunkSize];
while ( totalSize )
{
if( chunkSize > totalSize )
chunkSize = totalSize;
qint64 actuallyRead = ticket->read( readBuffer, chunkSize );
if( actuallyRead > 0 )
prnFile.write( readBuffer, actuallyRead );
else
break;
totalSize -= actuallyRead;
}
//Now Write the PDF file
qint64 ptotalSize = file->size();
qint64 pchunkSize = 2048; //you can increase it and decrease it as you will
char *preadBuffer = new char[pchunkSize];
while ( ptotalSize )
{
if( pchunkSize > ptotalSize )
pchunkSize = ptotalSize;
qint64 pactuallyRead = file->read( preadBuffer, pchunkSize );
if( pactuallyRead > 0 )
prnFile.write( preadBuffer, pactuallyRead );
else
break;
ptotalSize -= pactuallyRead;
}
// And when you're done:
delete[] preadBuffer;
prnFile.flush();
delete ticket;
delete file;
To copy to clipboard, switch view to plain text mode
Bookmarks