I'm trying to print some tables in Windows console using C++.
My codes under default console settings:
cout << "╭─┬╮\n"
"├─┼┤\n"
"╰─┴╯\n";//Code I hope to work
cout << "╭ ─ ┬ ╮\n"
"├ ─ ┼ ┤\n"
"╰ ─ ┴ ╯\n";//Have an extra whitespace behind every character
gave me
The characters only take one space instead of two. They are squeezed together.
I have tried but didn't work:
Change code page to 65001(UTF-8)
Turn on and off every option except legacy mode in cmd settings hoping it would work.
Change font
I then used legacy console mode and this time it work, but for some reason I need it to work in newer mode. Can you tell me how to configure it right or is it just a bug?
OS: Windows 10 1909
Environment: CLion 2021.2.4 + MSVC v142, C++11
Related
When Running my code I really only want to display the code I'm working on. I don't want to display what seems to be the folder address. Is there a way to not display that?
I mean when im running my code. I want to see the answer to my code only so to just display
28
.... not the folder name desktop/cpp etc etc
I noticed you were having some trouble with VS-Code.
Here's a good list of commands which can complete your task.
I noticed you stated that you were on a Mac as well, so more than likely the CTRL + option won't be necessary; try the " ⌘ + " instead!
To remove / hide the folder explorer window, simply hit "⌘ + b"
To remove / hide the terminal as well, try using "⌘ + `"
Edit:
I noticed you were also having some issues with the output of your code. The "addresses" to your output are symbols that ( usually ) address incorrect operations.
Try doing something like this when writing out your function:
printf( "i%\n" ); // <- Adding a newline to the operation deducts the symbol.
I hope this helps-
When I use to have Windows 7, I use to be able to use certain codes for my C++ programs to create acsii symbols. For example, if I did "cout << (char)1;" my program would display a white smiley face in the console box. Now since I updated to Windows 10, those codes do not work anymore.
I've done research and figured out the unicode from Windows 10 has changed. In the link below, I use to be able to use symbol/code 1 through 31 but now they appear not to work on Windows 10.
Link: https://www.alt-codes.net/
My question is, is there anyway to be able to get codes 1-31 back, possibly by downloading the Windows 7 unicode or is there a new symbol to paste the smiley face from the link? And if that's the case, how would I show it from doing this: "cout << (char) ??? ";
When I use cout < (char)1, it displays displays a box with a question mark inside of it.
Having this line of code:
print "S\x00A\x00V\x00A"
produces different output. On Windows:
S A V A
and on Linux:
SAVA
What is the difference between the the 2 platform and what can I do to remove the whitespaces from the Windows case?
The difference is at the terminal level.
Windows cmd prints the zero-char as empty whereas your Linux terminal doesn't print it.
Note that in PyScripter console or PyCrust console (wx-based) you only get S (probably because the zero is seen as a line-termination char). So it's definitely not portable :)
To get rid of it just perform a replace:
print("S\x00A\x00V\x00A".replace("\x00",""))
I red the following article and it seems like I should be able to define a variable of type varying that's size limit will be 16mb instead of 65535 characters.
http://www.mcpressonline.com/programming/rpg/v6r1-rpg-enhancements.html
This forum post suggests that it is posible to do this in V6.1.
http://www.code400.com/forum/forum/iseries-programming-languages/rpg-rpgle/11426-character-string-max-length
D BigVarying S a Len(25000000) Varying(4)
When I try to implement this I get the following errors and it seems like I cannot use Len(25000000) Varying(4)
Maybe I don't understand what exactly is meant by V6.1 but I checked on the Green screen using the command DSPSFWRSC and get the following Release V6R1..
I also checked by using I systems navigator and I checked the servers properties and it is : i5/OS version Version 6 Release 1 Modification 0.
The IDE I use to compile is IBM Websphere development studio
Version: 7.0.0
Build id: 20070202_0030
Trying to compile a RPGLE function.
Am I checking the correct version or is there a RPG version and how do you check it.
can you please help me out of my confusion.
V6.1 is your operating system version and you can refer to the V6.1 ILE RPG Language Reference here to see if it's possible. I think what you're looking for is on page 185.
I've just tested this in 7.2 and I am not getting the same errors.
D BigVarying S a Len(25000000) Varying(4)
RNF0501E Length of character item exceeds 16773104; length defaults to 16773104.
RNF0231E Length of varying length character item exceeds 16773100; length defaults to 16773100.
//Dcl-S BigVarying Varchar(25000000);
BigVarying = 'Hello world';
Return;
So, as the (duplicate) error mentions
Length of character item exceeds 16773104; length defaults to 16773104.
If you'd like a bigger length you'll need to update to a newer version of IBM i - but the max length is also 16773104, meaning 25000000 is invalid.
While RPGLE supports 16MB variables from 6.1 forward and you are on 6.1..
You have two problems:
25000000 (23.8MB) is bigger than 16773104 (~16MB)
Websphere Development Studio v7 (WDSc) is older than IBM i 6.1 (your build date is 2007, the article you're referencing came out in 2008). So your IDE doesn't recognize the new keywords and new max size.
Problem #2 isn't a deal breaker, you can simply ignore the errors in the IDE and compile on ther server successfully. If you were using the green screen editor SEU, you'd have to do the same as IBM stopped enhancing SEU at 6.1.
The thing is that on non-english versions of XP code pages for console and gui apps differ, for example if I on my Polish version write in console:
echo zażółć gęślą jaźń > somefile.txt
The content of that file is:
zaľ˘† g©lĄ ja«ä
This isn't happening if I put that into cmd file. That is this text with polish letters. But if I create a file or directory that is named using non English only chars, then no matter if it's run from cmd or from finger the effect is always gibberish.
So my question is how to get this second code page that rest of windows is running with. In my case this CP is 1250 - but how to get this number from c++ ?
GetConsoleCP() and GetConsoleOutputCP() both return 852 (which is correct) and GetThreadLocale() gives 1045.
If I try to chcp 1045 it gives "wrong code page".
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage\ACP - this registry key stores the ANSI code page number (it should be 1250 in your case) and HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Nls\CodePage\OEMCP stores OEM code page.
Oh, and there are GetACP and GetOEMCP functions.