|
hi all
i m using visuat stdio.net 2003 and mfc based applicaation.
following error occur in my application
debug assertion failed at atlsmptr.h at line 472
Expression (iChar>=0 && iChar <=GetLength())
it gives this error when i reach at this line marked by * during the debugging/executing.
asc=(int)m_strBarcodeValues[index].GetAt(1); * this line give error
where CString m_strBarcodeValues[91];
m_strBarcodeValues[32]=_T("011000100");//spacebar
asc=(int)m_strBarcodeValues[index].GetAt(0); works fine for this line
ddd
|
|
|
|
|
tasleem143 wrote: (iChar>=0 && iChar <=GetLength())
Means that either you are requesting a char at a position which is less than 0 or greater than the maximun length of the string itself, post the actual code then we will know more
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
thanks for reply
actually i was not calling the function that that used to initilze that particular cstring array. thanks once again.
ddd
|
|
|
|
|
Hello Tasleem
I am not getting y u r using an array of CString.
just declare an object of it as
CString str;
for (int i=0; i < somecondition ; ++i)
str.SetAt(i, somevalue);
I hope u got it.;)
By the way r u from Poona college.
|
|
|
|
|
thanks for the reply.
no yar i had not seen poona even in my dreams. i m from islamabd, pakistan.
ddd
|
|
|
|
|
Hello
I need some help with compiling some code. I need this for my class, and my C++ client isnt being to good to me.
I'm using MS Visual Studio 6.0
Visual C++ 6.0
And I'm trying to compile a bunch of data out to a text file. I can build the exe, but i cant run it (obviously). This error comes up:
"Cannot compile the file 'xxxxOUTPUT DIRECTORY.txt'; no compile tool is associated with the file extension."
Is there anything I can download, or any setting I can change? I'm really tight for time here, I got so much more to do and I'm stuck trying to fix this!
Any help is greatly appriciated!
Thanks
|
|
|
|
|
roborappa69 wrote: Is there anything I can download
Yep download some brain
but seriously man, that didn't make any sense
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
Come on man. I'm in high school and this thing is due in one week, and I got alot to get through. I'm asking why does this error come up when I need to compile to a text file?
My textbook shows it printing to an output as a txt file. And When I go and hit Build to "Text1.txt" it comes up with that error.
Is there any tool I can download to associate the compiler with the txt extension, or is there any settings I can change to associate it?
Whats so complicated about that?
|
|
|
|
|
Create a simple ATL project(dll),and then insert a simple ATL object into it!
Then add IShellExtInit and IContextMenu interface and associated functions, if you use the VC6(sp5) for compile, it work fine, but i use the VS.NET 2005, and it can't even compile, the errors are:
d:\workshop\Format.h(36) : error C2787: 'IContextMenu' : no GUID has been associated with this object
d:\workshop\Format.h(36) : error C2440: 'initializing' : cannot convert from 'DWORD_PTR' to 'const IID *' Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
d:\workshop\Format.h(36) : error C2440: 'initializing' : cannot convert from 'ATL::_ATL_CREATORARGFUNC (__cdecl *)' to 'DWORD_PTR' There is no context in which this conversion is possible
What should i do to fix this problem?
Tomorrow may be not exciting, but the exciting tomorrow surely will come.
|
|
|
|
|
VC6 and VS2005 are not compatiple
if you create a project in VS6 then it may or may not compile in VS2005 as the VS6 compiler was not "standards compliant"
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
I am already fix it, thanks all the same for your help!
|
|
|
|
|
I have a simple application in VC6.0 and ported it to .NET 2003.
I set "Use Managed Extensions" to Yes from the Project Properties->Configuration Properties->General because am using #using .
i get the foll error
Command line error D2016 : '/RTC1' and '/clr:initialappdomain' command-line
options are incompatible
i saw a lot of articles on this which suggested to do the foll to solve this error: i.e.
Open the project's Property Pages dialog box. For details, see Setting Visual C++ Project Properties.
Click the C/C++ folder.
Click the Code Generation property page.
Modify one or both of the following properties: Basic Runtime Checks or Smaller Type Check
i tried changing options under Basic Runtime Checks but to no avail?
i still get the error?
How can I solve this command line error?
Pls help!
Sincerely
Giftsana
|
|
|
|
|
I have a program that basically stores data coming over the UDP stack. Since the data is coming over so quickly I store the data to a binary file as opposed to an ASCII file like I once did.
I am looking for a way to convert my binary file over to an ASCII file that will look the same exact way as I had it before. Previously my file looked like this, with every "paragraph" being one line:
"Receiving Data"
00000001 00000020 00000000 9D818638 00040102 00000294 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00060105 0C2110F4 0C2110F4 0C2110F4 00020106 10F40C21 00010107 0E8A0000 00010108 135E0000
00000002 00000020 00000000 9D81863D 00040102 000002B5 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00010105 0C210000 00010106 10F40000 00010107 0E8A0000 00010108 135E0000
using this code:
CString temp = "";<br />
temp.Format("%08X", dataArray[i]);<br />
where data array is where I hold the data from the UDP stack and the next line after the format is to write the string to the file.
Right now my binary file looks like this:
OD OA OD OA 16 00 00 00 10 00 00 00 00 00 00 01 0F 00 02 01 02 00 00 FB C0 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 00 03 00 00 04 00 01 00 00 00 01 00 06 06 2A 2A 00 00 10 00 00 00 00 00 00
I would actually like to convert the file to actually show the OD OA OD OA to a carriage return and line feed. Most importantly I need to preserve the "paragraph" format so that I can use my decoding method.
Thanks in advance!!!
-- modified at 22:10 Wednesday 22nd March, 2006
|
|
|
|
|
NYTSX wrote: Since the data is coming over so quickly I store the data to a binary file
First of all: A file is a file. It won't be any faster just because you write *more* data in it as before!
Binary mode vs Text mode is just the way the data gets treated by the runtime.
For a text mode file:
A single '\n' will be written as \r\n in the file.
Upon read, \r\n in the file will be returned as a single '\n'. And the "End of file" character (ctrl-Z, decimal 26, hex 1A) will be treated as end of file.
That handling won't happen in a file opened in binary mode.
I suggest you do like this (assuming you are using the f-functions to handle the file):
For ever buffer of data you receive, save the data exactly as received, buffer for buffer. (Open the file binary mode, use fwrite to write the buffer to the file).
Open/create and close the file just once in your program.
Then use a hex dump program to view the file.
That way, you can see exactly what's going on.
If you want to look at the file as a text file, that will be difficult, since the file contains characters that have no ASCII/ANSI representation. That is all characters with a value below 32 decimal, 20 hex.
Maybe you can find a textviwer/editor who can handle those characters.
|
|
|
|
|
kakan wrote: First of all: A file is a file. It won't be any faster just because you write *more* data in it as before!
I guess, if I get it right, he intends to say, he stores data in binary immediately without converting them to ASCII format on the "receiving" point. may be because of more data flushing on to the stack, and later ,he might be converting them with another process running exculsively for converting them to ASCII. but i'm not sure
VuNic
|
|
|
|
|
Hello.
I'm not sure either. If he stores the received data "as is", and in binary mode (where appropriate), then there shouln't be any problem to extract interesting parts of the log file later on.
|
|
|
|
|
Sorry for the confusion. What I really meant to say was that Yes, I do save the data in binary immediately as I receive it using fopen() and fwrite().
What I am currently trying to build is the part that will take this file and convert it to ASCII.
I hope that clears things up some more, and that you guys will be able to help me do this.
Thanks a bunch.
|
|
|
|
|
OK, that clears things up quite a bit.
The big question is: How will you handle the data that has no characters in the ASCII/ANSI table? (That is: characters with a value below hex 20, decimal 32.)
Du you want to skip them in the outfile, or do you want them to have some special syntax (such as "\x00" for a 0 value)?
|
|
|
|
|
Either way would be fine....I guess the most logical way would be to set them to a 0 value since the majority of the data is going to be 0 anyways.
The only "real" words in the file is when I connect, I save this literal to file:
*** Connected *** which I see in the binary file as 2A 2A 2A 20 43 6F 6E 6E 65 63 74 65 64 20 2A 2A 2A.
The rest of the data in the file are numbers.
Thanks again Kakan for your help! This really is gonna save my butt!
|
|
|
|
|
OK, this has to be quick, since I'm at work...
There are other, maybe better ways to do this...
<code>
#include <stdio.h>
#include <string.h>
FILE *in;
FILE *out;
char * infileName = "infile";
char * outfileName = "outfile";
unsigned char buf[10];
if((in = fopen(infileName, "rb")) == NULL) {
printf("Nope. The infile %s doesn't exist!\n",infileName);
return 1;
}
if((ut = fopen(outfileName, "wb")) == NULL) {
printf("Nope. Can't create the out file %s!\n",outfileName);
fclose(in);
return 1;
}
// Process
while(fread((char *) buf,1,1,in) != 0) {
if(buf[0] >= (unsigned char) ' ') fwrite(buf,1,1,ut);
else {
// Values below space
if(buf[0] == (unsigned char) '\r' || buf[0] == (unsigned char) '\n') fwrite(buf,1,1,ut);
else fprintf(ut, "\x%02X", (unsigned int) buf[0]);
}
}
fclose(in);
fclose(ut);
return 0; // OK
</code>
This is written in a hurry, and partially untested. But it should work.
If you wan't to ommit "the low values", simply comment out the line
else fprintf(ut, "\x%02X", (int) buf[0]);
Good luck.
-- modified at 8:19 Thursday 23rd March, 2006
|
|
|
|
|
Thanks!
I will try this out and see if it works!
|
|
|
|
|
I've written a JAva program that uses JNI to call some C++ methods to retrieve webcam images using video for windows. The problem is that every time I retrieve an image, memory usage keeps going up. I'm still a noob to C++ so the problem may be something really simple. Here's my code:
code:
HWND m_capWindow;
int connectedIndex;
LRESULT PASCAL callbackProc(HWND hWnd, LPVIDEOHDR lpVHdr);
LRESULT PASCAL callbackProc(HWND hWnd, LPVIDEOHDR lpVHdr)
{
return 0;
}
JNIEXPORT void JNICALL Java_client_desktop_dateclick_Test_connect
(JNIEnv *, jobject, jint index) {
m_capWindow = capCreateCaptureWindow ("", WS_CHILD, 0, 0, 0, 0, GetDesktopWindow(), 10);
//m_capWindow = capCreateCaptureWindow ("Capture", WS_CHILD | WS_VISIBLE, 50, 50, 480, 360, GetDesktopWindow(), 10);
// connect to the new driver
BOOL rval = capDriverConnect (m_capWindow, index);
capSetCallbackOnFrame(m_capWindow, callbackProc);
capPreview(m_capWindow, FALSE);
}
JNIEXPORT jbyteArray JNICALL Java_client_desktop_dateclick_Test_getImage
(JNIEnv *env, jobject) {
CString fileName;
int contentLength;
BYTE *frame;
capGrabFrame(m_capWindow);
//capGrabFrameNoStop(m_capWindow);
fileName = "capframe.bmp"; //and use this file...
capFileSaveDIB( m_capWindow, (LPCTSTR)fileName);
CFile jpegTemp;
// now read the resulting file into a buffer
jpegTemp.Open("capframe.bmp", CFile::modeRead);
contentLength = (UINT)jpegTemp.GetLength();
//allocate the buffer for the jpeg frame
frame = new BYTE[contentLength];
//now read in the jpeg file
jpegTemp.Read(frame, contentLength);
jpegTemp.Close();
jbyteArray ba = env->NewByteArray(contentLength);
env->SetByteArrayRegion(ba, 0, contentLength, (jbyte*) frame);
delete frame
return ba;
}
JNIEXPORT void JNICALL Java_client_desktop_dateclick_Test_disconnect
(JNIEnv *env, jobject) {
capDriverDisconnect(m_capWindow);
}
|
|
|
|
|
Memory Leakage is caused by
khrstopher wrote: delete frame;
you should use
delete []frame;
|
|
|
|
|
If he's using any of the MSVC compilers I've worked with this will not result in a leak - It's wrong but it doesn't result in a memory leak.
Steve
|
|
|
|
|
hi
i am using visual studio c++ 6 and SDK (feb 2003 edition)
I want to display data from a database in a dialog box i have. Do i use a editbox or ??
From reading a few sites i see that datasets or a datagrid is used, i cant seem to find this in VC++6
where is it or what am i ment to use
many thanks
|
|
|
|
|