|
SandipG wrote: Does this command work in HyperTerminal
yes ...
the number is getting dialed thro' HyperTerminal ...
it is working perfectly there ...
Apurv
|
|
|
|
|
What does your program do after read buffer??
Regards,
Sandip.
|
|
|
|
|
in the HyperTerminal, when the command ATDW2289759 is given the response is VCON,
but in my code the response is OK
Apurv
|
|
|
|
|
there is a while loop as follows :
while(1)
{
if(kbhit())
{
key=getch();
if(key=='x')
{
CloseHandle(hCom);
exit(0);
}
switch(key)
{
case '1':
}
}
}
Apurv
|
|
|
|
|
well... its done !
the problem was, i was sending the command as a complete string, the modem needed the command in the pieces ... i mean character-by-character ....
the problem is solved ...
thanx to all of u ....
Apurv
|
|
|
|
|
See documentation for SetCommTimeouts.
After that verify your AT command string.
As debugging tool, I would turn on modem speaker if you have one.
Also verify that COM3 is valid and unused by other application.
"
When reading from a communications device, the behavior of ReadFile is governed by the current communication time-outs as set and retrieved using the SetCommTimeouts and GetCommTimeouts functions. Unpredictable results can occur if you fail to set the time-out values. For more information about communication time-outs, see COMMTIMEOUTS.
"
|
|
|
|
|
THANX Vaclav_Sal
.... will check it soon ....
Apurv
|
|
|
|
|
how to set the timeouts ??
what should be the second parameter to SetCommTimeouts() function ?
Apurv
|
|
|
|
|
I have a function that uses a variable argument list, but the va_arg macro always throws an exception. Why can't I use CString objects as my arguments? What am I doing wrong? My code is below.
void COdb::WriteAttribute( CStdioFile& fileOutput,
const CString& strTagName,
const CString& strAttribute,
const CString& strValue, ... )
{
va_list vl;
va_start( vl, strValue );
CString strBuffer;
strBuffer.Format( " <%s %s=\"%s\"/>",
strTagName, strAttribute, strValue );
CString strOpAttr = va_arg( vl, CString );
}
|
|
|
|
|
Royce Fickling wrote: Why can't I use CString objects as my arguments?
Why don't you use LPCTSTR as the parameter types instead?
void COdb::WriteAttribute( CStdioFile& fileOutput, LPCTSTR strTagName, LPCTSTR strAttribute, LPCTSTR strValue, ... )
{
va_list vl;
va_start( vl, strValue );
CString strBuffer;
strBuffer.Format( " <%s %s=\"%s\"/>", strTagName, strAttribute, strValue);
LPCTSTR strOpAttr = va_arg( vl, LPCTSTR);
}
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Interesting.
I looked at this for a while. The problem is the "strValue"
argument. The offset of the strValue parameter is used to calculate
the offset of the start of the variable-length parameter list.
If you don't pass it by reference the function works fine.
I can't figure out why the reference doesn't work - the sizeof a reference
is the same as the sizeof a CString (4 bytes on my 32-bit build), so I would
expect the same result.
I guess references are passed on the stack differently.
I don't think this old C feature was meant to deal with C++ references anyway...
Regardless, passing strValue by value instead of by reference fixes it:
void COdb::WriteAttribute( CStdioFile& fileOutput,
const CString& strTagName,
const CString& strAttribute,
const CString strValue, ... )
...
If anyone wants to analyze this further, here's the macro definitions:
#define _ADDRESSOF(v) ( &reinterpret_cast<const char &>(v) )
#define _INTSIZEOF(n) ( (sizeof(n) + sizeof(int) - 1) & ~(sizeof(int) - 1) )
#define _crt_va_start(ap,v) ( ap = (va_list)_ADDRESSOF(v) + _INTSIZEOF(v) )
#define _crt_va_arg(ap,t) ( *(t *)((ap += _INTSIZEOF(t)) - _INTSIZEOF(t)) )
#define _crt_va_end(ap) ( ap = (va_list)0 )
*edit* Now that the caffeine has kicked in, I realize taking the address<br />
of a reference gives you the address of the object referenced, not the<br />
address of the reference. Yeah - those macros weren't meant to work<br />
with references
Mark
Mark Salsbery
Microsoft MVP - Visual C++
modified on Friday, August 29, 2008 2:09 PM
|
|
|
|
|
After converting the CString reference parameters to LPCTSTR parameters, it works, but only when the optional parameters are actually passed. When they are not passed, I still get garbage in the 1st optional parameter. So how do I determine when I have them and when I don't? I thought that if the optional arguments were not passed, the first call to va_arg would return a null, but that is not the case. I have posted my code below.
void COdb::WriteAttribute( CStdioFile& fileOutput,
LPCTSTR strTagName,
LPCTSTR strAttribute,
LPCTSTR strValue, ... )
{
va_list vl;
va_start( vl, strValue );
CString strBuffer;
strBuffer.Format( " <%s %s=\"%s\"/>",
strTagName, strAttribute, strValue );
LPCTSTR pstrOpArg = va_arg( vl, LPCTSTR );
CString strOption;
bool bAttr = true;
while ( pstrOpArg )
{
if ( bAttr )
{
strOption.Format( "%s=", pstrOpArg );
strBuffer += strOption;
bAttr = false;
}
else
{
strOption.Format( "\"%s\"", pstrOpArg );
strBuffer += strOption;
bAttr = true;
}
pstrOpArg = va_arg( vl, LPCTSTR );
}
fileOutput.WriteString( strBuffer );
}
|
|
|
|
|
Royce Fickling wrote: I thought that if the optional arguments were not passed, the first call to va_arg would return a null, but that is not the case.
Yes, that is NOT the case. You'd need to pass a NULL parameter.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi all,
Can somebody tell me what is the best way to find number of characters and number of words of a std::wstring. Can somebody send a best example on the web if know. I search on the google but didn't find a best one.
Help really appreciate.
Thanks
I appreciate your help all the time...
CodingLover
|
|
|
|
|
CodingLover wrote: I search on the google but didn't find a best one.
Yeah that makes sense
led mike
|
|
|
|
|
Why did you say that?
I appreciate your help all the time...
CodingLover
|
|
|
|
|
As a first step, simply I found the number of spaces in a string and the length of it. So I can count number of characters there.
No I want to calculate number of words there. So I want to find a combination a space and immediately follows a character. Because that's the start of a word. How can I detect that combination? Any comments.
I appreciate your help all the time...
CodingLover
|
|
|
|
|
you can test the value of a character like (buf[x] == 'c')
there are also C runtime functions like isdigit() that you can find in the documentation
led mike
|
|
|
|
|
|
hey im working on video processing project bt i need help in capturing
frames from an video of .dat format
*** we will specify the path of video file and den the code should access that video
and capture frames from it and den store the captured frames from dat video at
the location where we will specify.
|
|
|
|
|
You will need the specs for the .dat file...
there's lots of proprietary .dat formats - I don't
know of any standard formats.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
hey mark
specs as in wat sense? i didn get wat u wana say.....
nywys even if u can tell me frame extraction for any type of video it would be
helpful to me....
|
|
|
|
|
suresh zende wrote: specs as in wat sense?
specs == specifications.
What's in the file? You can't extract frames if you
don't know where they are in the file or what format
they are in.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
im considering an sports video here bt it wont matter wat video file we r takin
we are having the video file from which we hv to extract frames
as a video file is nothing but sequence of frames..eg: 1 sec video will hv around 24/30 frames
so the task is to take snapshots of the video as the timepasses,so here we hv to take atleast
24/30 snapshots in 1 second to get good no of frames those can be processed....
hope nw the prbml is clear..plz help me for this..
|
|
|
|
|
I would start with clearly defining the steps you need to take
to accomplish your task. It's still unclear to me.
This is what I have so far:
Open the file
Loop until done:
Read a video frame
Do something with the video frame
Close the file
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|