What does 'directed to standard output (cout)' means? - c++

I just downloaded this code in which it says in the manual that the 'main results are directed to standard output (cout)'. However, when I run the code as described in the manual, everything runs just fine but I don't see any results showing on the terminal (not being written to an output file either)
This is a Linux code so I tried to run it form both Ubuntu terminal and from cygwin but I'm having the same problem - nothing is showing.
Could it be that 'the main results are directed to a standard output (cout)' means anything else? Other that it's supposed to show the results on the terminal?

There's no other meaning that I can think of for "standard output (cout)" - it should be the terminal that's running the program. Are you sure the program produces output?

Unless you have the source code, it's a little difficult for you (or us) to tell if it may have another meaning ("directed to standard output (cout)" is a little hard to misinterpret however, there's no other sane reading of that snippet).
If you do have the source, you can look for the cout <<-type statements to ensure something is done. You may have to examine the logic closely to see why nothing is being output for your specific case.
If you can share the source with us, we could help out further but it doesn't appear you're comfortable with that so the "analyse the code yourself" is probably the best answer you'll get.
Of course, there's always the option of going back to the author if your analysis is not going well, or if you don't have the source.

Ensure that there is no "wrapper" script encapsulating the program, which is internally redirecting the standard output to a file.

Related

Fortran program produces empty output

For a college course I'm required to work with Fortran77 codes which I know nothing about. Programs are prewritten, we only change input. On my computer though programs produce no output (they create a file, but it's empty). The very same code works on other computers. I treid using FLUSH and it didn't work. I use Force 2.0 as my programming enviroment. Something I can do about this?

C++ Terminal-Output not one after another

I'm sorry if this question sounds a little childish, but I'm very new to C++ and console applications.
I recently wrote a HTTP1.1-Client to down/upload files. Everything works fine. The Problem is that there are quite a lot of logs to be output on the terminal and there is also the content of the remote host that should be print to the terminal. At the end of the application some of the output is not well formed - sometimes the order ist not right and sometimes the messages are just broken apart.
The application does not use multithreading and uses the libraries SPDLOG and FMT::FORMAT to output the data. The code is way to big to be put in here but if you'd anyway like to see it i can as well post it here.
I'd be thankful for every suggestion about what I might have done wrong and what the problem might be. Thanks!

Program I just made is apparently a virus? C++

Okay so I just made a C++ program that is basically a notebook,
you write stuff in it and it saves it to a .dat file and then you can
read it later.
I compiled it with Microsoft Visual C++ and now I sent it to a friend and it's
saying that it is a virus? I scan it online and it also says that it's a virus.
I don't know why this is happening, as I literally just used some if/else statements, created some strings and used a couple getlines. (and fstream to create the .dat files).
This is the virus report: https://www.virustotal.com/en/file/a1b72280a32915429607fd5abeef1aad4f8310867df1feb7707ea0f7a404026e/analysis/1455735299/
Here is my code. (Its 400+ lines). And I'm almost certain there's nothing wrong
with it. http://pastebin.com/ZwJZrRSu
Any idea why this is happening?
Most probably your PC is already infected by a virus, which adds itself to any executable it can find on your machine. That would easily explain this behavior. Try to compile the same program on PC that is clean for sure and check your PC by antivirus.
I am not sure but I think it because you imported kernel32.dll
Again, it is hard to tell without the source
Also take a look at the file detail in the report

Following the flow of code

I'm trying to learn the level format in one of my favourite games, which is almost totally undocumented. Basically the only document that describes the level format is simply by saying things like First 12 bytes: header 4 following bytes: number of materials x next bytes: array of materials, and things like that.
I'm very inexperienced in hex and don't completely understand what they're saying. However, there is a level editor, and the source is freely available on google code. I was thinking of adding this in to my visual studio and trying to learn the level format by reading how the level editor opens the files.
However, another problem, I don't know c++ (I know python). This means I probably won't be able to locate which part of the code reads the bytes and whatnot.
What I'm looking for, is something that will allow me to follow the flow of the code, in its execution. Essentially something that acts similar to setting a breakpoint on every line, and having it show me what specific portion of code is executing when reading the file contents.
However, obviously setting breakpoints on every line is very messy and slow. I'm looking for something that will simply show me what code is being run when I open the file in the editor.
Does anyone know what I could do? Thanks.
You're looking for a feature to step from one statement to the next; every debugger I know has such a feature. You start by setting a single breakpoint at the beginning of the interesting region, and starting from there you "step" through your code.
E.g. in Visual C++ 2010, the key F10 does one step; you can also "step into" the next statement (e.g. a method call) with F11.
In your case, set the breakpoint to where the reading of the level file starts, and continue from there. To find the place where the file is read can be a hard problem as well - depending on the clearness of the code; but if it's well written code, there should be a method with "read" in the name or "load" or something similar - you'll figure it out!
You might have to know at least some basic C++ syntax to be able to follow what's going, though.
I would also recommend reading up on Debugging HowTo's (e.g this one).
The document wich you find so obscure, is just the level format specifications, in most cases the specifications are all you need. You need as well some little extra experience with file reading.
When reading a file you have to warry about few things.
1) When reading byte by byte (8 bits) order is no changed.
2) When reading 32bits at a time byte order can change according to endianness of machine.
(for example 0x12345678 becomes 0x78563412 when endiannes changes)
There was a very old tutorial that can help you loading 3D models that helped me to start working with files:
http://www.spacesimulator.net/wiki/index.php?title=Tutorials:3ds_Loader
this is usefull because you have part of the specifications (like in original documentation) and it shows how you can create a loader just starting from specifications. That's all you need. That's C but there is no big difference from C++ in this case.
If you need some other simple file format specification with related file loader for making things clearer to you, you can also look at libktx and ktx specifications:
http://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/
If I remember correctly there's also a unofficial C++ KTX loader you can look at if you itend to write C++ oop code rather than C.

Ignored silent flag in a test run

I'm currently trying to use the PlUnit test suit and encounter a problem to turn off the output of my predicates during the test.
The documentation says that I should be fine with something along the lines of set_test_options([silent(true)])., however that doesn't seem to have any effect on my test runs.
I tried to put those options into my load_test_files/1 call as well, but it didn't change anything.
If anyone can provide help about this library that'll be gratefully read, as I seem to misunderstand the documentation and am getting nowhere when trying to see what fails here.