|
Thanks all. That clears it up quite a bit.
Jamie Nordmeyer
Portland, Oregon, USA
|
|
|
|
|
i've connected the ODBC database in my app (quite easy)....but how do i generate reports thru my application or is there any way i can call Access to generate reports for me? suggestions, codes or books all welcome? plz help..
|
|
|
|
|
I think the only way is to read each record by your application and create report.you can find good information here:
http://lnrpc2.irb.hr/ebooks/0672313502/index.htm
Mazy
You can find a solution (even a foolish one) for all problems (even big ones)
|
|
|
|
|
Hi,
just you see this one may be useful for you.
Printing with MFC Made Easy by Dan Pilat in printing option of this site.
Also you can try with Crystal Reports .
anju
|
|
|
|
|
Does anyone here do code correction?
if you want to give me your email i will send you my code to look at it
if you want to help me out.
but i cannot post it here
thanks
|
|
|
|
|
Code correction. As in look through your code and find or fix errors...or just make suggestions...?
How many lines of code are we talking...?
p.s-You would get great response(I imagine) if you did post it to code project, whereas if only a few look at it...you'll get mediocre(spelling) results i'm sure.
"2 heads are better than one" - Some genius
laterz
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
774 c:\windows\desktop\datastru\main.cpp
warning: multi-character character constant
774 c:\windows\desktop\datastru\main.cpp
warning: comparison is always true due to limited range of data type
anybody knows what this is?
thanks
|
|
|
|
|
You should look up these warnings in MSDN, and you should try posting some code as well to help us answer you.
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Picture the daffodil. And while you do that, I'll be over here going through your stuff.
|
|
|
|
|
can i send the code to your email account
coz i don't want nobody see it
please reply
thank you
|
|
|
|
|
Why don't you want anyone to see it? is your code so bad that you're embarrassed of it?
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
C:\Windows\Desktop\DataStru\main.cpp(735) : error C2100: illegal indirection
can any one tell me what this mean?
thank you
|
|
|
|
|
Seeing the faulty code could help. But it is a pointer problem, for sure
|
|
|
|
|
can anyone tell me please how do you compile and run a program that reads its input from a txt file, using the borland commmand line compiler.
or the visual C++ compiler.
thanks
|
|
|
|
|
Just push the button with the '!' on it. Or did you mean how to write such a program ?
Here is a program to read a file into a vector and then print it.
#include "stdafx.h"
#include <string>
#include <vector>
#include <algorithm>
#include <fstream>
#include <iostream>
#include <sstream>
using std::copy;
using std::vector;
using std::string;
using std::ifstream;
using std::ostream_iterator;
using std::cout;
using std::back_inserter;
using std::getline;
using std::ostringstream;
using std::istream_iterator;
int main(int argc, char* argv[])
{
string currentLine;
ifstream str("c:\\winzip.log");
if (!str.is_open())
{
cout << "It's stuffed\n";
return -1;
}
vector<string> file_contents;
copy(istream_iterator<string>(str),istream_iterator<string>(), back_inserter(file_contents));
// Now print out the results
copy(file_contents.begin(), file_contents.end(), ostream_iterator<string>(cout, "\n"));
return 0;
}
You can use this URL to go to where I posted it before, and dissected how it works.
http://www.codeproject.com/script/comments/forums.asp?forumid=1647&select=105228&tid=104762#xx104770xx
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Picture the daffodil. And while you do that, I'll be over here going through your stuff.
Picture a world without war, without hate. And I can picture us attacking that world, because they would never expect it.
|
|
|
|
|
Christian Graus wrote:
Picture the daffodil. And while you do that, I'll be over here going through your stuff
I like that :rotfl:
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
I've noticed that sometime upon exiting my program, it errors out with a "memory could not be read". While debugging I see that my string buffers are not reseting themselves. How can I go about clearing my buffers out so that I do not get this error. Or am I looking in the wrong place. I still am curious as to how I go about resetting my buffers each time........
Please be patient with me as I am a cobol programmer (but I understand C++) and in cobol you must initialize your buffers so that left over data does not stay put.
Thanks again
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Hi,
I was trying to write some string in a bitmap. Every things work fond except that I cannot change the font size. Why can I put my font in italic without any problem and I can't change my font size. This code is use in a ISAPI. Source code follow...
Thanks
Guillaume Frechette
bool Write(CString sText,int nFontType,int nFontSize,CRect cRect)
{
CClientDC dc(NULL);
CDC mdc;
CFont* pFont=NULL;
CFont* pOldFont=NULL;
CFont myFont;
LOGFONT lf;
mdc.CreateCompatibleDC(&dc);
CBitmap* pOldBitmap = mdc.SelectObject(&m_Image);
BITMAP bmp;
m_Image.GetBitmap(&bmp);
pFont = mdc.GetCurrentFont();
if(pFont){
pFont->GetLogFont(&lf);
lf.lfHeight = -MulDiv(nFontSize,
GetDeviceCaps(dc.GetSafeHdc(),LOGPIXELSY),72);
lf.lfWidth = 0;
lf.lfItalic = 1;
myFont.CreateFontIndirect(&lf);
}
else
return false;
pOldFont = mdc.SelectObject(&myFont);
mdc.DrawText(_T(sText),cRect,DT_LEFT|DT_VCENTER|DT_SINGLELINE);
dc.BitBlt(0,0,bmp.bmWidth,bmp.bmHeight,&mdc,0,0,SRCCOPY);
if(pOldFont)
mdc.SelectObject(pOldFont);
CBitmap* pNewBitmap = mdc.SelectObject(pOldBitmap);
return true;
}
|
|
|
|
|
Okay I have
char StringBuf[32400];
char StringData[10];
strncpy(StringData, StringBuf, 10);
I want to move the first 10 characters from StringBuf to StringData. Wehn I do this if I look at StringData then it have everything from StringBuf in it. How come I see the whole buff of StringBuf in a smaller character array?
Is there a better way to do this?
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
If you view the contents using debugger, you'll see a lot of garbage info in the end of StringData. That's okay. But never use them. That is, never use index greater than sizeof(StringData), otherwise, you'll get those garbage data. It'll get worse if you try to write to those memory location. Your program might crash because of these illegal memory access.
|
|
|
|
|
What you want to do is:
char StringData[11];
memcpy(StringData, StringBuf, 10);
StringData[10] = '\0';
Anyway, the proper way to handle strings in C++ is to use std::string class, and not to hack with char*
I vote pro drink
|
|
|
|
|
strncpy does not insert a null. You have to do that manually. I think that is one we've all been bit by at some time. Nemanja's advice is your best alternative.
"Thank you, thank you very much" Elvis.
|
|
|
|
|
This is what I ended up doing before I tried Nemanja's advice...which by the way was the best advice.
StringBuf[11] = 0x00;
strcpy(StringData, StringBuf);
but I still got garbage in the front of the string that I wanted.
After switching to Nemanja's advice it worked great.
Thanks everyone.
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Tom Wright wrote:
StringBuf[11] = 0x00;
strcpy(StringData, StringBuf);
but in your first post, you were doing it the other way round...
a handy mnemonic to remember is that strcpy and strncpy are layed out like an equals command:
a="hello ";
b="world";
strcpy(a,b);
and noone complain that that code doesnt work, it was an example of a point and it's not really necessary to allocate memory for a concept
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
If you must use C strings, then you should do this:
char StringBuf[32400];
memset(&StringBuf, 0, 32400); // I *think* I have the parameters in the right order
Now your string is FULL of NULL, so whatever you copy into it will be NULL terminated.
It's better to use std::string, or you can use CString if you need to convert to wide strings at any point. Then you get operator =, and the strings will resize themselves to take up as much room as you need, and no more.
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Picture the daffodil. And while you do that, I'll be over here going through your stuff.
|
|
|
|
|
I have a NT Service (usually runs on Win2K AS), that accepts requests on sockets, process them, and return a response.
We noticed, using Task Manger, that the service had nearly 50,000,000 page faults (after processing around 500,000 requests). Is this normal? If it is not, what could be the cause?
Tx
Michel
P.S.: The service operations don't seem to be affected.
|
|
|
|