|
thanks for your help, that's the worse thing I've ever met >.<
|
|
|
|
|
Cadimi wrote: FILE *fout = fopen( "config.pcm", "wb" );
Are you using a relative path?
What is the value of temp ?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
temp is the number of hotkeys, its value is the size of the vector contain my HOTKEY struct
|
|
|
|
|
Cadimi wrote: temp is the number of hotkeys, its value is the size of the vector contain my HOTKEY struct
I know what it represents. I asked what its value was (at the time of writing to the file).
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I tried a simple example, its value at that time is 1
|
|
|
|
|
Ok, what do the two subsequent calls to fwrite() return?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I just watch the file pointer, it increase the value equal to the size I've requested to write on file
|
|
|
|
|
But what do the two subsequent calls to fwrite() return?
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I've found my problem ... It happened when I ust CFileDialog in another code, select a path, then the default directory change too => write file at another place => can't read. Thanks for your help
|
|
|
|
|
Cadimi wrote: ...can't read.
Which is why I was asking if fopen() was failing.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
struct nids_prm
{
...
void (*syslog) ();
...
};
static void my_nids_syslog(int type, int errnum, struct ip_header *iph, void *data)
{}
main()
{
nids_params.syslog = my_nids_syslog;
...
}
error C2440: '=' : cannot convert from 'void (__cdecl *)(int,int,struct ip_header *,void *)' to 'void (__cdecl *)(void)'
how to solve it?
|
|
|
|
|
CHYGO wrote: error C2440: '=' : cannot convert from 'void (__cdecl *)(int,int,struct ip_header *,void *)' to 'void (__cdecl *)(void)'
i think i cannot explain more clear than that.
function parameters are not same.
CHYGO wrote: how to solve it?
it depends on your need, may be,
struct nids_prm
{
...
void (*syslog) (int,int,struct ip_header *,void *);
...
}; matches your need.
BTW, a basic C programing book can also solve.
|
|
|
|
|
thx, i need another mothes
i'll try it
|
|
|
|
|
Short answer: this way
struct nids_prm
{
...
void (*syslog) (int , int , struct ip_header *, void *);
...
};
Long answer: use variable number of argument for your functions (and modify accordigly syslog declaration).
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
thank u
|
|
|
|
|
In nids_prm struct, replace void (*syslog) (); with this: void ( *syslog ) ( int , int , struct ip_header * , void * );
When you declare a function pointer, you have to define exactly the parameters of that function ^^. Enjoy yourself ^^
|
|
|
|
|
i've tried ,and the error is the same
|
|
|
|
|
CHYGO wrote: cannot convert from 'void (__cdecl *)(int,int,struct ip_header *,void *)' to 'void (__cdecl *)(void)'
that's pretty clear, no ?
you're passing parameters to a function which requires none !
|
|
|
|
|
i don't know what's the problem is -_-!
when i drag the .c file into the VC6, the build the default project,then compile ,nothing happen
but when i build a WIN32 or MFC application , the error occur...
|
|
|
|
|
When you build the single .c file, VC6 treats the code as valid C.
The WIN32/MFC app is probably treating the code as C++, which in this case is invalid.
|
|
|
|
|
There are two possible solutions available to you:
1)
void (*syslog)(int, int, ip_header*, void*); 2)
static void my_nids_syslog()
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
error LNK2019: unresolved external symbol _LoadIFilter@12 referenced in function "bool __cdecl CreateIFilter(char *)" (?CreateIFilter@@YA_NPAD@Z)
Here is the code that I wrote:
#include <stdio.h>
#include <windows.h>
#include <locale.h>
#include <filter.h>
#include <filterr.h>
#include <ntquery.h>
bool CreateIFilter(const WCHAR *wcsPath)
{
IFilter *pIFilter = NULL;
HRESULT hr = LoadIFilter(wcsPath, NULL, (void**)&pIFilter);
if (SUCCEEDED(hr))
return true;
else
return false;
}
void DumpProps(char *filename) {
// Translate filename to Unicode.
WCHAR wcFilename[1024];
setlocale( LC_ALL, "" );
int i = mbstowcs(wcFilename, filename, strlen(filename));
setlocale( LC_ALL, "C" );
wcFilename[i] = 0;
if(CreateIFilter(wcFilename))
printf("Ok");
else
printf("False");
}
|
|
|
|
|
definition of the function is missing, easy way is to go to the documentation page of [LoadIFilter^] and check the Requirements section it specifies which library to link, "Import Library: Use ntquery.lib."
|
|
|
|
|
Please, read the posting guidelines at the top of this forum before posting. Use "code block" whenever you need to post code.
From the documentation[^], LoadFilter is defined in ntquery.lib, did you link against that lib file ?
|
|
|
|
|
might be you have to include this line of code in your application :-
#pragma comment(lib,"ntquery.lib")
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You/codeProject$$>
|
|
|
|