OutputDebugString + DebugView = not tabs! - c++

I am dumping \t delimited data using using OutputDebugString and then use ex-Sysinternals DebugView to capture it.
The problem is that all the data in DebugView appear to be space delimited, hence I need to perfrorm CTRL+H "\x20" "t" to replace spaces with the tabs before I can use it (I really need tab delimited data).
Is there anyway to tell DebugView not to replace tabs with spaces?
Or maybe there is a better tool available to capture output of the OutputDebugString function?
Any ideas are very welcome!

It seems this is a "feature" in DebugView. I have tried with Hoo Wintail and this dude collects tabs without any problem. So I see 3 solutions:
You get Hoo Wintail (highly recommended)
You write your on tool (look here for some idea how to do it or even get a complete one)
You redirect to file.
I strongly vote for option 1.

Why not write them on a local log-file ? (only on debug mode ?)

You can use multiple spaces instead of a tab.

DebugOutput and DebugView are intended for situations as implied by their name: debug. They are not intended to replace file-save functionality.
You are probably in the situation where analyzing the debug output means analyzing the tab-delimited format. Find another character that can be used instead of tab, e.g. | or # or ^.
Then open the debug output in an advanced editor (e.g. UltraEdit) and convert the character back to Tab.

Related

How to get page break character in pycharm

So extracting text with pdftotext is quicker if you have it all in one file instead of one page per file. There is a special character being used as page break, but pycharm does not register it if I search for it. In sublime it shows up as <0x0c>. I cannot copy it here either. Is there a way to replace them with another readable character? Or to read it somehow to register when a page has changed?

C++ Error-code <U+0013>

I have a function in C++ that I am testing, and after careful inspection I'm pretty sure everything is correct. However, I'm still getting a mysterious error relating to the "return" statement at the end of the function.
Where "population" is a real matrix (using the armadillo matrix package).
Looks like the error code represents a Unicode value. Check if the file is clean of characters which shouldn't be there (copy paste into notepad and then copy paste back).
You have accidentally managed to enter the Device Control 3 character (which has the unicode value U+0031) before return and after ;. The character is probably invisible for you, which is why you aren't seeing anything.
Replace those with spaces. You can probably turn your editor into some kind of "show invisibles" mode which might help.
If you are used to using Emacs keybindings and tried to Cx-s Cx-c to save and quit in another IDE ie Xcode it will insert odd unicode characters.

Linux Printing - How To

I find it hard to explain but I will try my best. Some times in Linux- in the Terminal- things get printed but you can still write over them. eg when using wget you get a progress bar like this:
[===================> ]
Now if you type something while it is doing this it will 'overwrite' it. My question is how to recreate this in c++.
Will you use something like
cout <<
or something else?
I hope you understand what I am getting at...
btw I am using the most recent version of Arch with xfce4
Printing a carriage return character \r is typically interpreted in Linux as returning you to the beginning of the line. Try this, for example:
std::cout << "Hello\rJ";
The output will be:
Jello
This does depend on your terminal, however, so you should look up the meaning of particular control characters for your terminal.
For a more cross-platform solution and the ability to do more complex text-based user interfaces, take a look at ncurses.
You can print the special character \b to go back one space. Then you can print a space to blank it out, or another character to overwrite what was there. You can also use \r to return to the beginning of the current output line and write again from there.
Controlling the terminal involved sending various escape sequences to it, in order to move the cursor around and such.
http://www.ibiblio.org/pub/historic-linux/ftp-archives/tsx-11.mit.edu/Oct-07-1996/info/vt102.codes
You could also use ncurses to do this.

SAS Progam Editor on Unix

Is there a way to autoindent or a shortcut to insert a select number of spaces as a tab in the SAS Progam Editor on Unix?
I'm used to using the enhanced editor on PC and this is the only part of the switch that I can't find the answer to.
On the line numbers to the left of the code in the program editor, enter the >># command (replace # with a number) to indent '#' spaces to the right and <<# for shifting to the left. Enter these commands on the starting line and ending line. All rows inclusive between them will shift.
For a single line, ># or <#.
Without trying to start a flame-war... have you and your team considered NOT using the tab key in code? This way code always appears consistent regardless of editor/tab settings. Especially handy when you use a combination of vi/EG/SAS editor/notepad etc... I've worked at places that do this and it works great once you get everyone to agree to it.
When you open up existing code with tabs, just figure out how many spaces the tab is supposed to represent and do a search/replace.
It's still as fast to navigate quickly when you use, ctrl-left/ctrl-right in windows editors (and unix eds if setup that way), or 'w' and 'b' to jump to the next/previous word when using vi.
Cheers
Rob

Easily comment (C++) code in vim

I have looked at the following question:
How to comment out a block of Python code in Vim
But that does not seem to work for me. How do I comment code easily without resorting to plugins/scripts?
Use ctrl-V to do a block selection and then hit I followed by //[ESC].
Alternatively, use shift-V to do a line-based select and then type :s:^://[Enter]. The latter part could easily go into a mapping. eg:
:vmap // :s:^://<CR>
Then you just shift-V, select the range, and type // (or whatever you bind it to).
You can add this to your .vimrc file
map <C-c> :s/^/\/\//<Enter>
Then when you need to comment a section just select all lines (Shift-V + movement) and then press CtrlC.
To un-comment you can define in a similar way
map <C-u> :s/^\/\///<Enter>
that removes a // at begin of line from the selected range when pressing CtrlU.
You can use the NERD commenter plugin for vim, which has support for a whole bunch of languages (I'm sure C++ is one of them). With this installed, to comment/uncomment any line, use <Leader>ci. To do the same for a block of text, select text by entering the visual mode and use the same command as above.
There are other features in this such as comment n lines by supplying a count before the command, yank before comment with <Leader>cy, comment to end of line with <Leader>c$, and many others, which you can read about in the link. I've found this plugin to be extremely useful and is one of my 'must have' plugins.
There's always #ifdef CHECK_THIS_LATER ... #endif which has the advantage of not causing problems with nested C-style comments (if you use them) and is easy to find and either uncomment or remove completely later.