|
That's what I've done... But the function I use always returns FALSE...
Any ideas?
|
|
|
|
|
If LoadLibrary() fails, you shouldn't bother doing that other stuff.
HINSTANCE g_hDllXtlPes;
g_hDllXtlPes = LoadLibrary("XtlPes.dll");
if (NULL != g_hDllXtlPes)
{
typedef LONG (__cdecl *PESDEMUX_ProcessFile)(CHAR*,CHAR*,INT);
PESDEMUX_ProcessFile pPESDEMUX_ProcessFile;
CHAR chInFileName[255];
strcpy(chInFileName, m_csPCFileName);
CHAR chOutFileName[255];
m_csPCFileName = m_csPCFileName + ".mpg";
strcpy(chOutFileName, m_csPCFileName);
INT Type = 1;
pPESDEMUX_ProcessFile = (PESDEMUX_ProcessFile)GetProcAddress(theApp.g_hDllXtlPes,"PESDEMUX_ProcessFile");
if (NULL != pPESDEMUX_ProcessFile)
{
BOOL BResult;
BResult = pPESDEMUX_ProcessFile(chInFileName,chOutFileName,Type);
}
else
{
DWORD dwResult = GetLastError();
FreeLibrary(theApp.g_hDllXtlUsb);
return FALSE;
}
}
else
DWORD dwResult = GetLastError(); Note the calls to GetLastError() .
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
GetLastError() return 0.
Any ideas ?
|
|
|
|
|
So g_hDllXtlPes is NULL and GetLastError() returned 0. Is that right?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
g_hDllXtlPes is not NULL but GetLastError() returned 0
|
|
|
|
|
Ok, so what's the problem? If g_hDllXtlPes is not NULL , I would expect GetLastError() to return 0. That means no error!
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
True but I have an error message "Unhandled exception in Appli.exe (XTLPES.DLL): 0xC0000005:Access Violation"...
And I haven't the result I would like to have which is the conversion of a file...
|
|
|
|
|
Set a breakpoint on the LoadLibrary() statement and step through each successive statement until the exception occurs. My guess is that you are calling the PESDEMUX_ProcessFile() function incorrectly or with invalid parameters.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Hi !
I'm using the std::vector class. Let's say my vector has 10 elements. I want to reach, with an iterator the fifth.
Here is what I'd like to do :
std::vector::iterator MyIt=MyVector.begin();
MyIt=MyIt+5;
MyResult=(*MyIt);
But it doesn't work. The only way I could make it work is to have a loop which will do five time ++MyIt !
Why can't I just to MyIt=MyIt+5 ? Any suggestions ?
Thanks !
Jerome
|
|
|
|
|
std::vector has random access iterators so you should be able to to do MYIt = MyIt + 5;
If you dont want to use a loop, you can use advance, which works for both random access and forward/reverse iterators.
#include < vector >
#include < iostream >
#include < algorithm >
using namespace std;
int main(int argc, char* argv[])
{
vector< int > v;
for (int i = 0;i<10;++i)
v.push_back(i);
vector< int >::iterator it = v.begin();
it = it + 5;
cout << *it << endl;
advance(it, 2);
cout << *it << endl;
return 0;
}
---
“Our solar system is Jupiter and a bunch of junk” - Charley Lineweaver 2002
|
|
|
|
|
It works here ...
vector<int> MyVector;
for(int i = 0; i < 10; i++)
MyVector.push_back(i +1);
std::vector<int>::iterator MyIt = MyVector.begin();
MyIt=MyIt+5;
int MyResult = (*MyIt);
cout << MyResult << endl;
MyIt = MyIt + 3;
MyResult = (*MyIt);
cout << MyResult << endl;
Result screen:
6
9
<b>Maxwell Chen</b>
|
|
|
|
|
Looks like it might just be a syntax error. Try changing
std::vector::iterator MyIt=MyVector.begin(); to
std::vector‹int›::iterator MyIt=MyVector.begin();
Notice the ‹int› after vector. Wow I never realized how much of a pain it was to put angle brackets in.
- Aaron
|
|
|
|
|
Hi all;
I am having some serious problems with CDialogBar. I cannot initialise the controls found on it. Its the tenth time that i am posting (posted as Krugger) this particular topic but i have not yet gone through it. Can somebody please help me. If you want a copy of the class implementation as well as a screenshot of the application i am developing to better understand, please mail me and i will send it to you.
Thank you for your help
|
|
|
|
|
Hi all;
I am having some serious problems with CDialogBar. I cannot initialise the controls found on it. Its the tenth time that i am asking for help for this particular topic but i have not yet gone through it. Can somebody please help me. If you want a copy of the class implementation as well as a screenshot of the application i am developing to better understand, please mail me and i will send it to you.
Thank you for your help
|
|
|
|
|
how can i show the contents of "cout" used in C++ in Visual C++ 6 ?
|
|
|
|
|
If you meant that you wants to show some texts with cout with VC++6, here's the simple example.
#include <iostream>
using namespace std;
void main()
{
int iAge = 29;
cout << "Hello.\n" << "My age = " << iAge << endl;
}
Maxwell Chen
|
|
|
|
|
Or you can try :
cout.flush()
~RaGE();
|
|
|
|
|
HELLO!
PLEASE HELP ME!
I'm new in C/C++ programming.
And i have a problem:
here is the code:
char ch=fgetc(filein);
char s[20]="";
Now what I want is to put in string s the value that is the ord(c).
Example:if c is 'a' then I want put in s value "97".
This part of my code is written in ANSI/C language.
How can I do this?
Thank you very much!
|
|
|
|
|
I assume that ord(c) should return you the ASCII value of char c (maybe I misunderstand you). Therefore,
char c = 'a';
is equivalent to
char c = 97;
Then to get a string like "97", I would recommend using sprintf, as explained in Mike's FAQ on this link.
sprintf ( s, "%d", c );
Hope this helps.
~RaGE();
|
|
|
|
|
I am quite a beginner myself, but I think u can use pointers to do this.
Something like:
char *ptrs=NULL;
char s[20]="a, c, d, f, l, m";
ptrs=&s[3];//pointer points le address of s[3]
printf(" %d\n", s[3]);//should print the address
*ptrs=63; //value of pointer is 63
printf(" %d\n", s[3]);//should print 63
I think this is not correct, but might give you ideas.
THX
|
|
|
|
|
dairiseky wrote:
...the return will be all the time -infinte.
What is an infinite return value?
Does the file C:\My Files\SensorFile.txt exist? Do you have read permission on the file?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
I have a problem that a Dialog shouldn't be left via pressing a key. I have no default button on this dialog, but pressing ENTER results in leaving the dialog with a positive result (OnOK).
Is there a way to prevent the dialog to leave when pressing ENTER without ovverriding the OnOK method?
|
|
|
|
|
What does ur default implementatino of OnOk() event do ?
If its not doing anything you can very well override it and dont call the baseclass OnOK.
MSN Messenger.
prakashnadar@msn.com
"If history isn't good, just burn it." - Sidhuism.
|
|
|
|
|
Implementation of OnOK() is displaying an error message if the validation of the dialog fails.
So this is not the solution I'm looking for, because I want to prevent the execution of OnOK() and doing the validations.
|
|
|
|
|
if you disable the OnOk call then when will it be ever called and validation will be performed ?
MSN Messenger.
prakashnadar@msn.com
"If history isn't good, just burn it." - Sidhuism.
|
|
|
|