Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Hi i have one document in word. And i want this document to separate in two documents with the text i wrote. I was trying to do a seek but was unsuccesfully. Some way to solve this?
I tried to do this:
file1.seek(servidor.size() - sizeotherfile );
such an approach would max. work in a plain text file.
But you are just literally splitting the file and writing something in between. Most files have a defined structure of course.
docx for example is based on XML.
Jeronimo last edited by
@raven-worx i could seek files like txt or doc i did one program for linux but in windows not seems to work
Jeronimo last edited by
@raven-worx in linux i do this:
and works extract me the files(for example one .txt in two txt) but when i do for windows like you see upside i can't
it's impossible to give you any help, when you keep saying that "you can't" or something "doesn't work" and with 2 lines of code.
What exactly makes you think that it doesn't work?
What is the output? Is the file completely overwritten (from the beginning)?
Print the values passed to seek() and read() and make sure they are correct.
@raven-worx But my question is i can seek files in other path?????. Works but when i try in other path i can't to seek files in other place i put a little of code to take one idea.
Motherfile->seek(Motherfile->size() - 1024);
i read the mother file
trama = Motherfile->read(1024);
after i use one split to separate the different sizes of files with names
tamano1 = trama.split("|@|");
tamano2 = trama.split("|@|");
tamano3 = trama.split("|@|");
nombre1 = trama.split("|@|");
nombre2 = trama.split("|@|");
And then i select path of my files
First-txt->setFileName("./" + nombre1);
Second-txt->setFileName("./" + nombre2);
Motherfile->seek(tamano1.toInt() + tamano2.toInt());
But when i try to put in other path for example in my Home i can't why i can't change the path?? or i am unclear still?
Change path how?
Do you mean with
void QFile::setFileName(const QString &name)
"Sets the name of the file. The name can have no path, a relative path, or an absolute path."
Do not call this function if the file has already been opened.
@mrjj Solved i changed putting the path in setfilename but one questionwhy when i open show me different files if i have one only txt???