|
I am trying to print all the characters in MIDI command to a file.
If I open and see file in binary editor, all the characters like 0xF0, 0x43 are OK except the zero. How can I print zero in file.
If I add zero to CString it is not added in CString actually.
The code is:
FILE *pFile;<br />
CString strOut = "";<br />
unsigned char uc;<br />
pFile = fopen("DEBUG_FILE.TXT","a");<br />
for(int i = 0; i < lpMIDIOut->Header.dwBufferLength; i++){<br />
strOut = "\0";<br />
uc = lpMIDIOut->bBuffer[i];<br />
strOut += uc; <br />
if(uc == 0){<br />
fprintf(pFile,"0","%d");<br />
}<br />
else<br />
fprintf(pFile, strOut, "%c");<br />
}<br />
fprintf(pFile, "\n");<br />
fclose(pFile);<br />
Best Regards,
Suman
|
|
|
|
|
Yuk!
Writing binary data into a text file? You should know better than to do that.
You could at least encode the non-printable characters using some sort of encoding? Look at how HTML encodes stuff.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.soonr.com">SoonR Inc -- PC Power delivered to your phone</A>
|
|
|
|
|
rp_suman wrote: fprintf(pFile, strOut, "%c");
rp_suman wrote: fprintf(pFile,"0","%d");
Format specification fields must precede actual data.
BTW, what are you trying to do? Do you want to write a text file with the hexadecimal representation of the data?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
CPallini wrote: Do you want to write a text file with the hexadecimal representation of the data?
Yes, but I want to know how to write the zero when the unsigned char variable value is zero.
Best Regards,
Suman
BTW, Zero is finded out by India, I am an Indian, but I'm struggling how to print that!!
|
|
|
|
|
Have a llok at the following code snippet:
unsigned char buffer[]={ 65, 48, 0, 96 };
int i;
FILE * fpOut = fopen("out.txt", "w");
for (i=0; i<sizeof(buffer); i++)
{
fprintf(fpOut, "%02x", buffer[i]);
}
fclose(fpOut);
it outputs a file whose content is:
41300060
That is the hexadecimal representation of the buffer (note: each byte is represented with a couple of hexadecimal digits, i.e. Zero is 00 )
Hope that helps.
BTW, maybe who invented Zero was far more smarter than me and you...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
CPallini wrote: Format specification fields must precede actual data.
Hi,
Thanks for your great help!!
I forget the order, and now it is solved.
Best Regards,
Suman
|
|
|
|
|
The question describes as follows:In CxxActiveXCtrl I declare a member m_dlgMain for a dialog which was produce for display the picture and In CxxActiveXCtrl::OnCreate(LPCREATESTRUCT lpCreateStruct) function I wrote "m_dlgMain.Create(IDD_MAINDIALOG,this);",then in the dialog's OnInitDialog() procedure I use IPicture to display the specified picture,the display codes is correct,but can see nothing in the html,while move the codes to the dialog's OnDraw() it works ok,I suppose the dialog doesn't notify the control to erease the background but I've written InvalidRect(TRUE) after display.What's the matter?
|
|
|
|
|
need know how to write a program run on system tray
|
|
|
|
|
|
|
Urgent
Nobody can give you wiser advice than yourself. - Cicero
|
|
|
|
|
URGENT!
Mark Salsbery
Microsoft MVP - Visual C++
This episode brought to you by the letter Z
|
|
|
|
|
how do we use the progress bar. for example if u are copying something from an external storge to the hardisk it shows a progress bar and the time left. how is the time calculated and how is it implemented in the system???
Chandrasrkharan P
|
|
|
|
|
If you search the articles here for "progress control" or "progress bar" you'll find lots of
articles about using the progress bar control.
The MSDN reference is here: Progress Bar Control Reference[^]
You can calculate time however you want. For example, using percent-done is simple.
Set the range of the progress bar to 0-100. Periodically during a lengthy operation, calculate
the percent-done (amountdonesofar * 100 / totaltodo) and use that value to set the progress bar's
position.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
This episode brought to you by the letter Z
|
|
|
|
|
|
Here is one such example.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Does anybody know how to using Windows API, disable the sound for a single application only?
Thanks,
Nate
|
|
|
|
|
Can you more explain what programs?
|
|
|
|
|
It doesn't matter what program. Any program. I want to be able to disable all sound originating from any application of my choosing programmatically. I don't want to disable sound for all applications. I only want to selectively disable sound.
|
|
|
|
|
Do you have access to the code of said application? If not, then using Vista is the only solution that I'm aware of.
Another "possibility" would be to create some sort of monitoring application that simply monitored all created processes and if a process was created that should have no sound, act accordingly.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
LRESULT OnTest(HWND hMetin, WPARAM wParam, LPARAM lParam)
{
hMetin = FindWindow(NULL, "metin");
Sleep(5000);
//Mouse move
SetCursorPos(100, 200);
Sleep(500);
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, GetMessageExtraInfo());
Sleep(500);
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, GetMessageExtraInfo());
Sleep(500);
//This code is Keybd source of send Message
SendMessage(hMetin, WM_CHAR, 'd', 0); Sleep(100);
SendMessage(hMetin, WM_KEYDOWN, 'd', 0); Sleep(100);
SendMessage(hMetin, WM_KEYUP, 'd', 0); Sleep(100);
SendMessage(hMetin, WM_KEYDOWN, 'd', 0); Sleep(100);
SendMessage(hMetin, WM_CHAR, 'd', 0); Sleep(100);
SendMessage(hMetin, WM_KEYUP, 'd', 0); Sleep(100);
return 0;
}
------
Hi..
I am working Macro-Program of a online game.all function is success,but keymessage can't.But Text type is possible.In the online game is impossible to send the keyboard message.It maybe different the keymessage that send a device
and C++.
Ah..and To work the Network game,It's very a difficult problem.
Thanks in advance
and Now i am living in Korea ^^
Hi..
I like a C++
|
|
|
|
|
Please read the forum guidelines. Your message titles should not contain words like "help" or "urgent."
Also, do no repost your question. You must be patient for an answer.
______________________
stuff + cats = awesome
|
|
|
|
|
Maybe look into the SendInput Function[^] or the keybd_event Function[^].
I'm not sure how all those Sleep() calls effect your user interface. You're on your own there
Mark
Mark Salsbery
Microsoft MVP - Visual C++
This episode brought to you by the letter Z
|
|
|
|
|
I have an MFC app, developed on windows XP, that makes use of the alpha blending features of comctl32.dll version 6.0. I now need to make that app back compatible to Windows 2000, which only supports version 5.8.
Is there some way to install comctl32.dll version 6.0 onto Windows 2000? My app specifies the comctrl version through a manifest (see below), but as far as I can see Windows 2000 doesn't have a GAC.
<dependency>
<dependentassembly>
<assemblyidentity
type="win32"
="" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorarchitecture="X86" publickeytoken="6595b64144ccf1df" language="*">
Aaron Stibich
|
|
|
|
|
astibich2 wrote: Is there some way to install comctl32.dll version 6.0 onto Windows 2000?
I don't think so.
Shell and Common Controls Versions[^]
Mark
Mark Salsbery
Microsoft MVP - Visual C++
This episode brought to you by the letter Z
|
|
|
|