When I tried to use the autocorrection of the command cout in c++ it should autocorrect to something like cout<<a<<endl; but why does it keeps becoming cout<<a<<endl;>>>>
Is there any way to fix that?
here
Related
I started evaluating the qDecimal library, but I already encountered a baffling issue:
QDecDouble val(9.34);
val.add(QDecDouble(0.01));
qDebug() << val.toString();
outputs:
QDEBUG : UtilsTests::test() "9.340000000000000"
What am I doing wrong?
I can'f find anything with a fast search for QDecDouble... but I am almost sure that
val=val.add(QDecDouble(0.01));
would do the difference. The way you did it, the result did not saved somewhere...
Usually these commands returns the result that you want and you have to save it somewhere...
I have followed numerous examples littered around the web for running a python script from a Qt app, but I just cannot get it to work. I've tried this:
QProcess unknown error
Amongst many other examples.
I have even directly copied examples which other people have said works, but with no success at all. I simply cannot get a python script to run or even launch a cmd window. I can, however, launch notepad.
This, for example is called when I press a button:
void MainWindow::test()
{
qint64 pID;
QProcess *myProcess = new QProcess(this);
QStringList arguments;
arguments << "/k cd /d " << "c:\path to be opened";
myProcess->startDetached("cmd.exe", arguments, "", &pID);
}
To no avail.
Also, this:
QProcess p;
QStringList params;
params.clear();
params.append("C:\\Software\\Qt\\StarLib\\cadstar_workspace_paths.py");
params.append("C:\\Software\\Qt\\StarLib\\TP1268_RDU5.csw");
params.append("C:\\Software\\Qt\\StarLibcadstar_local_user_directories.txt");
p.setWorkingDirectory("C:\\Software\\Qt\\StarLib");
p.setProgram("py");
p.setArguments(params);
p.start();
if (!p.waitForStarted()) {
ui->textEdit->append("Could not start process");
return;
}
else
ui->textEdit->append("The program seems to have started.");
QTime time;
time.start();
while (time.elapsed() < 4000)
QApplication::processEvents();
p.kill();
p.waitForFinished();
With this code, it reports that the application seems to have started, even though it hasn't.
Can someone point me in the right direction please? Am happy to post any further relevant information that would help. I'm clearly missing something fundamental here!
Trying to run this code in the main function of a console app in QT but it only starts up the Blender GUI. These arguments should be starting a background render.
I tested the arguments to be correct and they work fine on CMD. This seems to be a blender specific issue but I might be wrong. It seems as though, using QProcess it doesn't allow for Blender to use the arguments. It launches the app without passing any arguments.
QProcess myProcess;
QString blender = "C:/Program Files/Blender Foundation/Blender/blender.exe";
QStringList arguments;
arguments << "blender" << "-b" << "E:/my/file.blend" << "-o" << " E:/my/output/folder/"<< "-a";
myProcess.start(blender,arguments);
Edit:
So browsing through SO, I found something that's working but this isn't using the QT functionality. I'd rather find the QT way of doing this. What it's essentially doing is running CMD and launching blender through the CMD. Is there a way I can do this using QT?
QDir::setCurrent(blender);
system("blender -b E:\\Blender\\BlendSwap\\55510_Ciclos_Town_-_10_Male_Characters\\cidade_ciclos-bonecos.blend -o E:\\Blender\\BlendSwap\\55510_Ciclos_Town_-_10_Male_Characters\\exp\\frame_### -a");
Thanks for #MaxGo and #G.M. because they set me on the right path.
Two things:
First off, tt's true that using the "blender" flag was one of the issues. I can't launch the .exe file and also expect blender to take in the arguments.
Second, start() will not work, you do need to use startDetached or execute() for it to work.
Below is the final code to make this launch correctly.
QDir::setCurrent(blenderDirectory);
myProcess.startDetached("blender -b " + projectPath + " -o " + projectOutput + " -a");
I use Dev-C++ , and I have a program in C where the output is not fully shown (only the last part is visible).
So, I tried with a simple program and I noticed the same problem , for example here :
#include <stdio.h>
#include <stdlib.h>
main(){
int i;
for(i=0;i<5000;i++){
printf("\n The number is : %d\n",i);
}
}
Well, when the program is finished, I only see in the Console numbers from (4852 to 4999), but I want to see all the output.
In most terminals you can scroll backwards to see what was printed earlier. In Windows, you can modify the visible history length by right-clicking on the titlebar at the top, choosing preferences and setting the Scrollback to as long as you like. In Linux, it is a property of the terminal emulator (try Shift-Page Up to scroll backwards).
You will need a 5000-line monitor. Try getting an array of the most powerful graphics cards you can buy and a high-res display array. Set the font to the smallest possible.
Alternatively, redirect the output to a printer and paste the output sheets to your wall.
Having the same problem I usually redirect the output to a text file.
When I do
#include <inttypes.h>
long long value = 0;
printf("An 8 byte long integer value: %"PRId64".", value);
Eclipse shows me a syntax error in the printf line. Anybody knows how to get rid of it? This is the only way I know to have a printf working on both 32-bit and 64-bit architectures and Eclipse errors every few lines make it quite hard to see the real issues.
Thanks!
The question was answered here.
You need to add __STDC_FORMAT_MACROS in Project Properties->C/C++ General->Paths and Symbols.