Ubuntu terminal not displaying all values - c

I have a C program that displays all the possibilities of the letters "A-B-C-D-E-F" can make. That comes to 720 possibilities. But my terminal is only displaying 511 possibilities. I tried looking online on how to edit terminal settings and found this following and did them. I went into edit>profile preferences and selected "use custom terminal size" and set both the values for rows and columns to 800. Sadly only 511 continues to display.
Can someone please tell me what is the solution to this, im really puzzled.
PS: Every entry is on its own line. For example:
ABCDEF
ABDCEF
......
......

In addition to less described by David Grayson, you should also be familiar with redirection:
my_program > outputfile.out
This creates a new file (or overwrites an existing one) with the output from your program. Now you can open the file in a text editor to look at the output. You can also use the wc utility to count the number of lines:
wc outputfile.out
If you only want to check that your program creates the correct amount of output, you can use the following pipe:
my_program | wc

You need to go to the Scrolling tab and set the number of lines in scroll buffer to something higher than 512.
Another useful utility to know about is less. You can pipe the output of your program into it and it lets you scroll around and search through the output:
my_program | less

I think you want to see all the output answers.you can see the answer from "answer" after you execute the program like a.out>answer.
now open the file(answer),you will see the result.
">" is a operator

Related

Trouble with Scilab "print" instruction

Trying to debug a program in Scilab, I inserted a couple
of "print" instructions to track what is going on.
At first, I used the %io(2) output "file" which, according
to the Help, stands for the console. Nothing happened.
Then I used an actual filename:
print("C:\Leszek\Xprmnt\scl\Ovsjanko\K3ScilabLog.txt", "START! \n \n \n \n GOING \n")
which does print to that file, but when the dust has settled
and I want to inspect the file what I find inside is just the last
message (just before the program crashed), even though there should
have been others before it, including the "START" etc in the quote above.
Apparently, every print command reopens the file for writing as a clean slate,
overwriting whatever was in it before. Looking into Help and online docs
I didn't find any options or parameters that I could use to change this.
What I want is, obviously, the output from all my print commands since the
beginning of the program, either on the console or in a text file.
TIA.
Just use disp("some text") or mprintf("format",var1,...,varn), both will display on the console. If you need to write in a file use fd = mopen("file.txt") then mfprint(fd,"format",var1,...,varn).

Resizing output Terminal in C Language

would like to get some help on a c project i am currently working on. I have a string/array of output to the terminal, but somehow the standard terminal is too small for my output. Even after i manually expand the window of the console the output is still cut off, instead of printing in a single line, it just gets cut off and go to the next row automatically.
hope to get help.
I think that the only way to correct this is by splitting your one-line output in multiple lines, using "\n" at the end of every line.
By doing this you can control when and where it has to write in the next line, and you can make it look more like you wanted to.

Output to terminal different than I redirect output to file AND output to terminal

So for some reason when I run my script and have it output to the terminal just as it would, I get my intended output. Yet when I redirect the output to a file, I don't receive full output.
Let's say I have an executable named "filename" and run it "./filename", the output on the terminal is, let's say :
a
b
c
Yet if I do "./filename > output.txt" or "./filename |& tee output.txt", the output on the terminal AND the output.txt text file is just, let's say:
a
b
I know this isn't very specific, but my output is huge. I was thinking this would be general enough to provide general solutions/ possible problems.
I'm using a program someone else made, so I don't know where this additional output is called. Yet, it shouldn't matter since the functionality of the program doesn't change, just what's being output.
Without a minimal code sample to reproduce, it's very hard to guess what's going on.
But some things you could try:
Redirect all output streams to your file, i.e. your-script &> output.txt
Run it through strace and look for write and open calls to see what's going on
Read and debug the source code to figure out what's going on

C: open second custom sized terminal and use it for output

I am writing a program in C that is started simply by the terminal. Now I want to make the program itself open another terminal with a custom size and write its output in there.
I found the command
system("gnome-terminal");
which opens another terminal, but I can't find a function that lets me write into this second terminal. I am using Ubuntu.
If you have any idea, that would be great
The easiest thing would probably be to write the output to a file, say /tmp/tmp96888 (tip: mkstemp) and then do something like
system("gnome-terminal --geometry=40x14 --command 'less /tmp/tmp96888'");
Or, to update continuously from the file:
system("gnome-terminal --geometry=40x14 --command 'tail -f /tmp/tmp96888'");
But if you can, I think the best way is to open a new terminal and run the program itself in it, and just print the output. It's only if you actually need to do things in the original window that you have to bother with a separate output window.

cmd truncates first lines of ouput

I'm debugging a program that could potentially have up to 20,000 lines output. The command prompt appears to truncate and only show the last 1000 so I can't see the ouptput the program gave at the begining. How can I fix this so I can scroll all the way up to the point where I run the program? I'm using Windows 7 and Codeblocks IDE.
Run cmd (as admin), go to Properties->Layout tab and increase the Screen buffer size to what you want, and enable "Apply these properties for future windows".
Another option, just to check the output: Have it written to a file and read it later.

Resources