简体   繁体   中英

ReadFile() Output to WinAPI edit Dialog

Ok, let's see if this all makes sense. Today, as I began working on a small project, I ran into an error I can't seem to get over. The function of the program I am working on is to read data from a pipe (which is the output of another program) and update an HWND ("edit") control dialog using WinAPI. Now, I've been successful at updating the dialog: sort of. If I send the character buffer from the ::ReadFile() function to the dialog, I get the proper output but with a ton of extra characters I don't want. So how can I simply strip it to the output I'm looking for, or is there a better way to accomplish what I'm attempting? Perhaps take the output and WriteFile(); or something similar to decipherable text?

Here is what's happening:

some output...'Hola Mondo' means... Hello word!ÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌÌ$

Here is what I want to happen:

some output...'Hola Mondo' means...

Hello word!

Thanks so much for your help!

Regards,
Dennis M.

检查ReadFile的“字节读取”输出参数,以便知道字符串的长度,然后在该偏移处放置一个终止的NUL(“\\ 0”)字符。

Most likely you're not 0-terminating your buffer before passing it to the text updating function.

Check the 'Example: Open a File for Reading' from here .

It looks like you just need to add a '\\0' termination character to the string you're passing to the edit control.

But your question should show the code including the ReadFile() and where you pass the data to the edit control so someone can say for sure (and give a better suggestion).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM