|
seem the .lib file that the dll author is not C++ compliant.
First the header file for the dll contains these functions:
void BASSVISDEF(BASS_SONIQUEVIS_CreateFakeSoniqueWnd);
void BASSVISDEF(BASS_SONIQUEVIS_DestroyFakeSoniqueWnd);
They Yield the following error and warnings:
c:\BassVisMFC\BassVisMFC\BassVis.h(49): warning C4229: anachronism used : modifiers on data are ignored
c:\BassVisMFC\BassVisMFC\BassVis.h(49): error C2182: 'BASS_SONIQUEVIS_CreateFakeSoniqueWnd' : illegal use of type 'void'
c:\BassVisMFC\BassVisMFC\BassVis.h(50): warning C4229: anachronism used : modifiers on data are ignored
c:\BassVisMFC\BassVisMFC\BassVis.h(50): error C2182: 'BASS_SONIQUEVIS_DestroyFakeSoniqueWnd' : illegal use of type 'void'
If I comment out from the header those offending lines since I don't seem to need them anyways I then get this linking error.
bass_vis.lib : warning LNK4003: invalid library format; library ignored
|
|
|
|
|
smesser wrote:
HDC hdc = HDC(VisWindow.GetDC());
BASS_SONIQUEVIS_Render(vischan, chan, hdc);
VisWindow.ReleaseDC((CDC*)hdc);
That's not going to work. You need to use:
CDC *pDC = VisWindow.GetDC();
BASS_SONIQUEVIS_Render(vischan, chan, pDC->getSafeHdc());
VisWindow.ReleaseDC(pDC); HDC and CDC* are not the same type - you can't typecast between them.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Finally got a version of the dll from the author and your suggestion works perfectly.
Thanks
|
|
|
|
|
Hi guys
I apologize for reposting this question but probably I didn't reach enough people last night and only got one response that didn't help me much (sorry Chris but thank you).
I'm still strugling with the problem of reading a huge file in the most efficient way. I was suggested last week to "read the file into memory as one big chunk". I think that the advice refered to reading the data in binary format instead of text. Cool... so first I have to translate my text files into binary and then read them... Problem is that all examples that I've found refer to either read a single number or things such as a struct with phone directory...
How about reading a 2 dimensional array of doubles as text, save it as binary and then load it into another array after reading the binary file???
examples???
Thanks a million.
|
|
|
|
|
A file is neither binary nor text as it resides on disk. It all depends on how the file is processed that determines whether it is binary or text. You can open the file and read all of it into memory with something like:
HANDLE hFile = CreateFile("myfile", GENERIC_READ, ...);
LPBYTE lpBuffer = new BYTE[10240];
DWORD dwRead;
ReadFile(hFile, lpBuffer, sizeof(BYTE) * 10240, &dwRead, NULL);
CloseHandle(hFile); Now you can do whatever you want with lpBuffer . You might also benefit from a memory-mapped file.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hi
Sorry if this sounds stupid, please bear with me since I'm a self instructed amateur.
If files are neither text or binary, what's the point of using something like:
To write a binary file
int MyNumber = 10;<br />
ofstream FileOut(FileName,ios::binary);<br />
FileOut.write((char*) &MyNumber, sizeof MyNumber);<br />
fout.close();
and to read
ifstream FileIn(FileName, ios::binary)<br />
FileIn.read((char*) &MyNumber,sizeof MyNumber);<br />
FileIn.close();<br />
Thanks a million you for your help
|
|
|
|
|
ios::binary is used to tell the ifstream and ofstream classes to treat the data as binary. If you don't specify ios::binary and try to read a binary file and if the binary file happens to have a non-text byte value, it'll stop there or throw an exception.
You can open any file in binary mode though, because ifstream and ofstream will not try to interpret them as text characters.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
OK... so I wrote the following code and it writes and reads the file with a map. It compiles, runs and gives the requested output, but apparently there's a runtime problem since after execution a window pops indicating that there was a problem (one of those windows to send information to the creator of the program)... I can't see what's wrong but I know where the problem is since I commented different sections of the code and narrowed it down to the marked fragment below.
Here's the code:
int main()<br />
{<br />
typedef map<int, double> IMAP;<br />
<br />
IMAP Grid, NewGrid;<br />
<br />
int IntValue1, rows = 3;<br />
double DouValue2;<br />
<br />
for(int i=0; i < rows; i++)<br />
{<br />
IntValue1 = i + 1;<br />
DouValue2 = i * 2;<br />
Grid.insert(IMAP::value_type(IntValue1, DouValue2));<br />
}<br />
<br />
IMAP::const_iterator IteratorG = Grid.begin();<br />
<br />
cout << "Original Map" << endl;<br />
while (IteratorG != Grid.end() )<br />
{<br />
cout << IteratorG->first << " " << IteratorG->second << endl;<br />
IteratorG ++;<br />
}<br />
<br />
ofstream FileOut("C:/MyBinary.bin" , ios::binary);<br />
FileOut.write((char*) &Grid, sizeof Grid);<br />
FileOut.close();<br />
THE ERROR IS FROM HERE
ifstream FileIn("C:/MyBinary.bin", ios::binary);<br />
FileIn.read((char*) &NewGrid,sizeof NewGrid);<br />
FileIn.close();<br />
TO HERE
IMAP::const_iterator NewIteratorG = NewGrid.begin();<br />
<br />
cout << " " << endl;<br />
cout << "New Map" << endl;<br />
while (NewIteratorG != NewGrid.end() )<br />
{<br />
cout << NewIteratorG->first << " " << NewIteratorG->second << endl;<br />
NewIteratorG ++;<br />
}<br />
return 0;<br />
}<br />
Thanks a million!
|
|
|
|
|
Writing out a std::map is not a good idea. It internally uses pointers and dynamically allocated memory, so writing the map will only write out the pointers and not their values. For eg
class Test
{
public:
int *p;
};
int main()
{
Test test;
test.p = new int();
*(test.p) = 100;
}
Writing out test to a file will write out p, which is just a address (and which will change for every program run). Because you're reading it back in the same program, you're alteast able to read back the values. Try reading the file after shutting down the program that wrote to it, you'll find that iteration itself crashes.
I'd suggest writing out the values to file, manually and then reading them back, (again manually).
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Hi Senthil
Thanks a lot for your response. I've actually found that you are partly right. I can't send the whole map at once for the reasons that you point out. However, if you send the map element by element it does work like a charm. For me, the reason to work with this containers is because I need to read a humongous file and then find a record or a series of records associated to a tag or tags (in which case I'd use a multimap). These containers have algorithms that make the search process incredibly fast and easy. If you are interested in the new version of the code (the one that works) I'll be happy to post it.
Cheers
Carlos
|
|
|
|
|
I try to make umanaged C++ class and managed C++ library.
I put it in C:\MathLibrary\Arithmetic.h , \MathLibrary.lib and \ManagedMathLibrary.dll.
But when I try to use it in my project such as put the dll in reference and change the project properties to tell the compiler the right path -> for unmanaged class and unmanaged lib, it doesn't work. What is the problem?
|
|
|
|
|
How would I be able to restrict the size of a text file then create another file to hold the over flow?
|
|
|
|
|
Simply, You Can Count The Number Of Bytes In the First File, !!!!
|
|
|
|
|
ha, ha. No, really how do you create multiple files?
|
|
|
|
|
Right before writing to the file, check to see if the file's current size plus the amount of text to be written would exceed some threshold. If it would, close the file, open/create the next file, write the text.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Am I going in the right direction? or what am I missing?
ifstream inClientFile ("diction.txt", ios::binary);
if(inClientFile != sizeof (10000));
{
ofstream outClientFile ("diction.txt", ios::app);
{
for (int a=0; a<=10; a++)
{
for (int aa=0; aa<10; aa++)
outClientFile<
|
|
|
|
|
Andrew Admire wrote:
if(inClientFile != sizeof (10000));
This is not the correct way to check a file's size. I'm not familar with istream /ostream /etc but I would look into the tellg() or tellp() methods.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
sizeof(10000) will only give you the size of an integer (typically 4 bytes). For finding the size of the file opened by ifstream, I've used this trick
inClientFile.seekg(ios::end);
int size = inClientFile.tellg();
Not sure about the parameter to seekg, but it used to work. Don't know if there are any better methods though.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
What about this? However I get a binary error about the !=. Then I tried to just read the file and I get the size 0, however when I look at the size it says 4Gb
ifstream inClientFile ("diction.txt", ios::in);
inClientFile.seekg(ios::end);
int size = inClientFile.tellg();
if (inClientFile != size)ofstream outClientFile ("diction.txt", ios::app);
{
for (int a=0; a<=10; a++)
{
for (int aa=0; aa<10; aa++)
outClientFile<
|
|
|
|
|
Help...
TO get the HTML code and change it on programm...
Tender_Nail
|
|
|
|
|
|
Hi all,
I need to find out at runtime what file types are supported on the target machine by DirectShow, or, alternatively, find out if a given file type (i.e. extension) is being supported.
If somebody could point me in the right direction, this would be greatly appreciated.
|
|
|
|
|
There is really no way of knowing since it is more the type that determines if it can be renderered or not.
You can create yourself a graph and call the renderfile function to see if it fails or not. Other than that, it is not as simple as checking if the file type is registered in explorer...
|
|
|
|
|
I’m using visual studio 7.0 2003 with c++ and MFC.
In the debugger when I’d put the cursor on a CString object I’d automatically see its value. Now, in a new project I only see things like “sql = {…}”.
I have to go down to a watch window where it is defined as
ATL::CSimpleStringT<char,0> and underneath that
m_pszData with the actual data.
Upon further investigation I see it is dependent upon if I use Managed Extensions. Without the managed extensions, I see the CString objects directly under the cursor in the debugger.
If I go to a watch window, it is defined slightly differently
ATL::CSimpleStringT<char,1> and again
m_pszData with the actual data.
Does anyone know what is the meaning of the difference and if I can do something in order to see CStrings like I’ve always seen them?
Thanks,
Ilan
|
|
|
|
|
Hello!
I have a big problem. Since yesterday morning I am experimenting, but i am not able to solve it. Since yesterday morning the VC++ 7.1 Linker (link.exe) shows me the error "Buffer Overrun detected".
It's no matter, which Project I am trying to link nor if I start the Linking from Visual Studio .Net or via the command line (with link.exe)
I already re-installed Visual Studio .Net for 3 times and scanned my Hard-Disks with Antivir PE, AdAware, HiJackthis, Spybot S&D and A-squared for Virus, Malware, Spyware,... and deleted everything it found.
After that I downloaded all from link.exe needed DLLs (msvc71.dll, mspdb71.dll,...) and replaced them, but this didn't solve my problem too.
At Last i tried so find the reason for the Problem with FileMon (www.sysinternals.com) but also without any success.
And no i am at a loss. Except a complete Operating System Reinstall i don't know anything more to solve the problem. Everything looks like it's bewitched.
Has anybode made the same experience?
Does anybody know how to solve this problem?
Many thanks in Advance!
|
|
|
|