|
It's at the end, ID3 v1 is clear text, v2 is compressed. There's a number of free classes on the web that do it, I don't have any of them anymore, sorry.
Please don't use fopen, unless you're using C and not C++. Use iostreams where you can.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
|
Go to http://www.wotsit.org and search for "MP3".
Best regards,
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
|
|
|
Thank you all for your answers, i think ill go with the id3lib.
Thanks!
|
|
|
|
|
Not sure where this belongs since it is a programming question:
Given a set S of n axis parallel rectangles, defined by their top-left and bottom right points, describe and analysis an efficient algorithm for determining the area of the union of S. Note that since the rectangles my overlap the answer in not simply the sum of the areas of the rectangles. Hint: Imagine sweeping a line over the rectangles and performing operations on a data structure when the line hits either the start or end of a rectangle.
From here[^]
|
|
|
|
|
It's a brave man indeed who posts a homework question with a link to the homework. It looks like you're past your due date tho ?
And I agree with the hint, try making an array of the points, sort them and then pass over them, keeping track of when you're in at least one rectangle.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Do you really expect us to take your 'take home quiz' for you?
Software Zen: delete this;
|
|
|
|
|
Apparently he does. But at least he's got the guts to link to the original question, so there's no doubt what it is...
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Hi,
it should be no problem. Sort x coords (starting and ending) of rectangle,
then proceed from left to right. And consider each point as an event. When you come to starting point of rectangle A, add rectangle A to list and test its y coords against all other rectangles in list. When you come to end point of rectangle A, remove rectangle A from the list. This should help you to determine total overlap area.
This algorithm should run in O(N*Log N + K), where N is number of rectangles and K is number of overlap areas. So note, this algorithm is
only good, when there is not great number of overlapping rectangles, because
it gets asymptotically to O(n^2). In such case, it's better to use
brutal force algorithm.
Pavel Celba
|
|
|
|
|
As I'm a network administrator in my full time job and a programmer in my spare time, I'm curious about Buffer Overflow's.
I've seen many security vulnerabilty's released as an exploit of a Buffer Overflow. What exactly does this mean, and how can I as a programmer prevent them from happening?
Thanks!
Frank
"Keyboard Error - Press F1 to Continue"
|
|
|
|
|
consider this old practice.
char input[20];
scanf("%s",input);
if you enter upto 20char its ok, but over 20chars causes the buffer to overflow and exception is raised.
|
|
|
|
|
In terms of prevention, look for strsafe.h on the MSDN web-site.
99.9% of the time, the buffer overflow attack is possible because someone was lax about checking what was being copied into a buffer, either because their routine doesn't know how big a buffer it's been given, or they just didn't bother.
It has to be said that the new features of the VS.NET C++ compiler help, but the problem is that the developer is likely to take the view that their code is safe because it didn't flag up as an overrun when it was tested. The real question is: can it be made to overrun?
Steve S
|
|
|
|
|
A buffer overflow is simply when you write past the end of a buffer. This typically means that you overwrite whatever was on the stack before the buffer. The major problem here is how the program stack is organised on an x86 system. The return address of a called function is stored on the stack by the CALL instruction. Overwriting the return address can cause the program to jump to a different address. If the attacker knows where the buffer is located in memory, he can write program code to the buffer, and cause the program to jump to an address in the buffer, executing the code he put there. Strictly speaking this is a stack buffer overflow.
The return address gets overwritten because the stack grows downwards in memory (towards lower addresses), whereas string operations proceed upwards in memory (towards higher addresses).
It's also possible to cause a heap buffer overflow, but this is usually less serious. However, if the attacker manages to overwrite a C++ object's vtable pointer, and the program calls a virtual function, he can again redirect the program's execution.
You can avoid buffer overflows by checking your buffer code. Be wary of calls to strcpy or any other function that performs an uncounted copy operation. Check that the sizes you've passed to counted copy operations are correct - some Windows functions take counts of elements, while others take counts of bytes. If you're working with WCHAR s or TCHAR s, remember that they can be 2 bytes in size (and therefore you need to divide the result of sizeof by sizeof(WCHAR) for an element-oriented function).
If you ensure that you only ever write an amount of data less than or equal to the size of the buffer, you will never have a buffer overflow.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Thanks for the info. Very good explanation.
Frank
"Keyboard Error - Press F1 to Continue"
|
|
|
|
|
Hello,
This is perhaps not a c++ question, although I am coding in c++.
I wish to write frames to an avi file while allowing another program to access this file simutanously for encoding and streaming.
I am calling:
- AVIInit
- AVIFileOpen Write
then looping:
- AddFrames.....
end loop
then calling
- AVIStreamClose
- AVIFileClose
- AVIFileExit
The file does not become available until after I close it.
Is there a better way to do this so that I can access as I write.
I have tried OF_SHARE_DENY_NONE with no success (it is an architecture issue)
Thanks,
|
|
|
|
|
Hi. I have a question with regards to processing windows messages. I have a block of pseudo code below:
while (TRUE)<br />
{ <br />
<br />
responded = get_response() ;<br />
<br />
if (responded == FALSE)<br />
<br />
else<br />
{<br />
threshold_found = process_success();<br />
<br />
if (threshold_found == FALSE)<br />
<br />
else<br />
{<br />
record_threshold() ;<br />
<br />
restart = restartTest() ;<br />
if(restart == FALSE)<br />
break ; <br />
}<br />
}<br />
}
I want to be able to receive keyboard messages while this while loop is executing and also to be able to detect any other messages like button clicks, etc...
I've tried to use PeekMessage :
while(iCheck == BST_CHECKED)<br />
{ <br />
gen_sound(0, 0.02, 1, current_frequency, duration) ;
<br />
while(PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))<br />
{<br />
TranslateMessage (&msg) ;<br />
DispatchMessage (&msg) ;<br />
<br />
if(msg.message == WM_COMMAND)<br />
{<br />
if(msg.wParam == IDC_START)
iCheck = (int) SendMessage(hCtrl, BM_GETCHECK, 0, 0) ;<br />
<br />
break ;<br />
}<br />
<br />
}<br />
}
but I can't seem to get it to retrieve any messages. I've implemented this code in a callback function that is subclassed from the main window so that it can intercept the window messages. Any insight on what I maybe doing wrong or any kind of advice on the matter would be greatly appreciated.
Fazly
|
|
|
|
|
I don't understand what your pseudocode is doing,
but generally, you shoud use worker thread to do some work in loop while
UI (original) thread is processing messages and controling the worker thread
rrrado
|
|
|
|
|
Hi,
does anyone know if there are deprecated headers and other files in
\Microsoft Visual Studio\VC98\INCLUDE\ ?
After my project mates and I were updating code to VC++ 7.0 standards and specifically the inclusion of <fstream> and "std::ofstream" and "std::ifstream", when I compile in VC++ 6.0 I get a lot of warnings with files in the above folder.
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\xmemory(39) : warning C4100: '_P' : unreferenced formal parameter
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\xmemory(41) : warning C4100: '_P' : unreferenced formal parameter
C:\Program Files\Microsoft Visual Studio\VC98\INCLUDE\xlocale(296) : warning C4663: C++ language change: to explicitly specialize class template 'codecvt' use the following syntax:
template<> class codecvt<unsigned short,char,int=""> ...
These are only three, but all seem to come from the \VC98\INCLUDE
Can anyone help or point me to references where VC++ 6.0 and "standard C++" may have been updated?
Thank you so much.
Johnny
|
|
|
|
|
How can I use functions and member variables from one dialog's class in the message handler of another dialog (in MFC)?
For example:
I have two dialogs, with classes CDlg1 & CDlg2. CDlg1 has a tab control and some generic function. CDlg2 (modeless) has a button control.
CDlg1.h looks like:
#include "Dlg2.h"
class CDlg1 : public CDialog
{
public:
CDlg1(CWnd* pParent = NULL); // Constructor
CDlg2 m_dlg2; // To create modeless in "Dlg1.cpp"
void function(); // Generic function in "Dlg1.cpp"
// Dialog Data
//{{AFX_DATA(CDlg1)
enum { IDD = IDD_DIALOG1 };
CTabCtrl m_tab; // Tab Control member variable
//}}AFX_DATA
// Overrides
//{{AFX_VIRTUAL(CDlg1)
protected:
virtual void DoDataExchange(CDataExchange* pDX);
//}}AFX_VIRTUAL
// Implementation
protected:
HICON m_hIcon;
// Generated message map functions
//{{AFX_MSG(CDlg1)
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CDlg2.h looks like:
class CDlg2 : public CDialog
{
public:
CDlg2(CWnd* pParent = NULL); // Constructor
// Dialog Data
//{{AFX_DATA(CDlg2)
enum { IDD = IDD_DIALOG2 };
//}}AFX_DATA
// Overrides
//{{AFX_VIRTUAL(CDlg2)
protected:
virtual void DoDataExchange(CDataExchange* pDX);
//}}AFX_VIRTUAL
// Implementation
protected:
// Generated message map functions
//{{AFX_MSG(CDlg2)
afx_msg void OnButton();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
In the message handler for the 2nd dialog's button, I want to call the function from CDlg1 & get info from the 1st dialog's tab control (GetCurSel() or whatever).
**** From CDlg2::OnButton() in "Dlg2.cpp", how do I call function()???? ****
Just calling "function();" alone gives me the old "undeclared identifier" shiznat.
And what's the best way to control m_tab? The following seems to work, but it seems it bit messy to me:
CTabCtrl* m_tabPtr = (CTabCtrl*) GetParentOwner()->GetDlgItem(IDC_TAB);
int nCurTabSel = m_tabPtr->GetCurSel();
When I try to derive CDlg2 from CDlg1, all hell breaks loose (operator error, I'm certain) and I can't seem to make "friend" work either. Am I even barking up the right tree?
Thanks,
-Chris, the MFC newb
|
|
|
|
|
In CDlg2, make a constructor that also accepts a pointer to a CDlg1 object, so that if CDlg1 calls the constructor for CDlg2, do it like this:
Cdlg2 dlg(this);
have the overloaded constructor put whatever was sent in in a member variable of type CDlg1 (m_pDlg1 = pDlg);
Also remember you don't have to include CDlg1.h in your CDlg2.h file, just put a forward declaration for CDlg1 before your class definition for CDlg2 like this:
class CDlg1;
class CDlg2 : public CDialog
{
//declare class attributes
}
hope I helped, if not let me know and i'll cut and paste you an actual piece of working code like that. Also, don't forget to make the function you're calling public or put CDlg2 in CDlg2's class definition as a friend class.
If it's broken, I probably did it
bdiamond
|
|
|
|
|
Thank you for your help -- I didn't know about the forward declaration, that sheds quite a bit of light on things.
But I can't seem to get the CDlg2 constructor right. Do I replace the standard constructor:
CDlg2(CWnd* pParent = NULL);
or just add to it? (Sorry, I'm an old hand at C, but fairly new to C++.)
And in your example, where is pDlg declared?
Thanks again!
-Chris
|
|
|
|
|
Why don't you just try passing in a pointer to CDlg1 from the constructor of CDlg2. That should take care of your tab control problem as well since you'd just be able to simply reference it. int nCurSel = pDlg1->m_tab.GetCurSel ()
- monrobot13
|
|
|
|