|
Can someone point me in the right direction please:
I need to figure out the these formulas to draw lines, but I'm not catching the gist of the formulas to display the data line.
The first line will start at x,y = (0,0) and end at x,y = (pi/4, 0.707). See Below
Samples Start End
1 0,0 pi/4,0.707 ---- Does this equate to 0.785398163 ------ ?
2 pi/4,0.707 pi/2,1
3 pi/2,1 3pi/4,0.707
4 3pi/4,0.707 pi,0
5 pi,0 5pi/4,-0.707
6 5pi/4,-0.707 3pi/2,-1
7 3pi/2,-1 7pi/4,-0.707
8 7pi/4,-0.707 2pi,0
Also, how is the formula with a number before the pi figured out? Is it the number * pi and the do the division on the number after the divisor sign?
Thanks to anyone who can help
FrankieB
|
|
|
|
|
yes, 3pi/4 = 3 *pi/4. The order of operation is unimportant.
Obviously you can't chart to a decimal point, these numbers need to be multiplied by something to become meaningful.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
The general formula to generate these numbers (if that's what you were after, your post is unclear to me) seems to be in pseudocode
<br />
start at 0,0<br />
number1 = linenr/4 * pi<br />
number2 = something like cos/sin of number1<br />
|
|
|
|
|
Can you clarify your suggestion:
What is - linenr/4 * pi
How do you use the cos and sin functions?
Thanks
|
|
|
|
|
For every line of your output: the first number corresponds to the linenumber divided by 4 and multiplied by pi, and the second number corresponds to the something like the sin/cos of the first number. sin/cos/sinh/cosh/acos/asin are in the C++ CRT. I'm not gonna explain their use, your teacher should.
|
|
|
|
|
Hello
Is it possible to use iostream, fstream with embedded Visual C++ 4?
I havo to port an application that uses this libraries to Pocket PC 2003, and seems that iostream, fstream etc are not present in eVC 4.
I´m using evc4 with service pack 4 and Pocket PC 2003 sdk.
Thanks in advance.
|
|
|
|
|
If not, then it's not C++.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
Hello,
I'm having a little problem. I don't get any compile or link errors
for this code, but when I run it I get:
Debug Assertion Failed!
Program: ...
File: fopen.c
Line: 53
Expression: file != NULL
<br />
#include <iostream><br />
#include <fstream><br />
<br />
using namespace std;<br />
<br />
unsigned char *openFile(char *, int&);<br />
<br />
int main(int argc, char **argv) {<br />
unsigned char *buffer;
char *fileName;<br />
int length;<br />
<br />
if (argc != 1) {<br />
cout << "Usage: " << argv[0] << " <pcap_file>" << endl;<br />
exit(1);<br />
} else {<br />
fileName = argv[1];<br />
buffer = openFile(fileName, length);<br />
}<br />
<br />
return 0;<br />
}<br />
<br />
unsigned char *openFile(char *fileName, int &length) {<br />
char *temp_buffer;<br />
unsigned char *buffer;<br />
ifstream theFile;<br />
<br />
theFile.open(fileName, ios::in|ios::binary);<br />
if (!theFile) {<br />
cout << "Can't open file " << *fileName << "!" << endl;<br />
exit(1);<br />
}<br />
<br />
theFile.seekg(0, ios::end);<br />
length = theFile.tellg();<br />
theFile.seekg(0, ios::beg);<br />
<br />
temp_buffer = new char [length];<br />
buffer = new unsigned char [length];<br />
<br />
theFile.read(temp_buffer,length);<br />
theFile.close();<br />
<br />
buffer = (unsigned char *) temp_buffer;<br />
<br />
return buffer;<br />
}<br />
The last delete[] temp_buffer; causes an assertion failure too,
when uncommented. I assume I'm makeing a really simple mistake. Anyone see it?
|
|
|
|
|
cockytrumpet wrote:
// delete[] temp_buffer; // why not!?
Easy - because if you delete it, you can't return it.
cockytrumpet wrote:
What's an assertion failure?
It means that the ASSERT macro has been used to make sure that the programmer ( in this case, someone at Microsoft, or who sold them a library ) has made correct assumptions. To get to the bottom of this, the best thing is to look at the file in question, see where the ASSERT is, and what it means.
<br />
FILE * __cdecl _tfsopen (<br />
const _TSCHAR *file,<br />
const _TSCHAR *mode<br />
,int shflag<br />
)<br />
{<br />
REG1 FILE *stream;<br />
REG2 FILE *retval;<br />
<br />
_ASSERTE(file != NULL); <- there it is<br />
_ASSERTE(*file != _T('\0'));<br />
_ASSERTE(mode != NULL);<br />
_ASSERTE(*mode != _T('\0'));<br />
<br />
<br />
<br />
<br />
if ((stream = _getstream()) == NULL) {<br />
errno = EMFILE;<br />
return(NULL);<br />
A null filename is being passed to this function. I reckon the problem is that you're grabbing the second parameter on the command line ( argv[1] ) instead of the first ( argv[0] ). Or is the first one a special value ? Either way, the argument you're grabbing is null.
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
cockytrumpet wrote:
if (argc != 1)
{
cout << "Usage: " << argv[0] << " <pcap_file>" << endl;
exit(1);
}
else
{
fileName = argv[1]; // argv[1] is invalid when argc equals 1
...
The condition in the if statement should be comparing against 2.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hello,
I`m trying to code an application that will remain in taskbar.. or like a system process. Can anyone give me some tips from where to start?
|
|
|
|
|
do you mean in the system tray next to the time? Take a look here
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
I guess that helps a little..but i still need a ssh client src, so a user can log in to a server and then go to tray.
Thanks in advance.
|
|
|
|
|
You can write a Windows NT system service and then have a separate applciation communciate to it using some form of interprocess communication. The secondary applet can appear in the system tray. It is not common, or the preferred method, to have a single application run as a service AND provide a user interface. You run into issues when the user logs off.
|
|
|
|
|
hello
1.
I tried putting some of my code that uses MFC inside a ordinary WIN32 dll and I get an error like this
nafxcw.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in otherdll.obj
Release/otherdll.dll : fatal error LNK1169: one or more multiply defined symbols found
this error I get whenever I try to #include some mfc headers that I need.
is there anyway to make a win32 dll accept MFC or do I have to make a mfc dll?
2.I dwd some sources of mfc dll and it seems like you can only import functions from them from MFC apps
can you not do the same from win32 apps?
and if so how?
3.I may need to send to the function I call from the dll a pointer to a IWebBrowser2 object
Is this possible?
does the dll know about IWebBrowser2? or does this not matter because pointer is pointer?
please reply to these questions
thank you in advance
|
|
|
|
|
Spiritofamerica wrote:
nafxcw.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in otherdll.obj
See here for possibilities.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
to lazy to log on
anyone have anything on the third issue????
|
|
|
|
|
Thanks to "toxcct" and "cedric moonen" Ive learned how to Link my CDialog's together, Thank you both!
<br />
#include Button01Dlg.h<br />
<br />
void CClientDlg::OnButton01() <br />
{<br />
CButton01Dlg dlg;<br />
dlg.DoModal();<br />
}<br />
But Ive come to Notice that only Text can be added to the CButton01Dlg on interface... I was wondering if there was a way to somehow get printf or cout working in Button01Dlg.cpp in order to apply variables?...
Thanks for any Help you guys seem to be the best forum ive found yet!
Just a Human Trying to Live in a Computers World.
|
|
|
|
|
NewbieStats wrote:
to somehow get printf or cout working
You could use sprintf() to write to a character string which could be displayed in a CStatic or CEdit control.
NewbieStats wrote:
Help you guys seem to be the best forum ive found yet!
That's because we are the best programming forum on this planet. (Just my objective humble opinion).
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Would it Go under;
<br />
CButton01Dlg::CButton01Dlg(CWnd* pParent )<br />
: CDialog(CButton01Dlg::IDD, pParent)<br />
{<br />
<br />
}<br />
or
<br />
void CButton01Dlg::DoDataExchange(CDataExchange* pDX)<br />
{<br />
CDialog::DoDataExchange(pDX);<br />
}<br />
or
<br />
BEGIN_MESSAGE_MAP(CButton01Dlg, CDialog)<br />
END_MESSAGE_MAP()<br />
Sorry im kinda new at Interface programs... ive only made databases and so forth jus dos based... But those are the only 3 sections under Button01Dlg.cpp where would i enter it and would it look like;
<br />
sprintf("%s %s you are %s years of age\n", First, Lastname, Age)<br />
<br />
Just a Human Trying to Live in a Computers World.
|
|
|
|
|
What I meant was, you could use sprintf() (which works exactly like printf() but writes to a string vs. standard output) to display values of variables which could be shown by a static text control (i.e. CStatic ) or an edit control (CEdit ). The latter is preferred, since it supports scrolling, which can come in handy when displaying large amounts of text.
The actual display would typically occur within a button handler. For example:
CMyDialog::OnBtnFooClicked()
{
char szResult [256];
int nFoo = someFunction(...);
sprintf (szResult, "nFoo = %d", nFoo);
m_myEditCtrl.SetWindowText (szResult);
CString strResult;
strResult.Format ("nFoo = %d", nFoo);
m_myEditCtrl.SetWindowText (strResult);
Hope this helps.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
I understand now...
Everything works out perfect besides for: "m_myEditCtrl"
I appoligize for my illiterate-ness in MFC...
C:\*\ClientDlg.cpp(190) : error C2065: 'm_myEditCtrl' : undeclared identifier
C:\*\ClientDlg.cpp(190) : error C2228: left of '.SetWindowTextA' must have class/struct/union type
Other then that i understand what you mean and how it will work, but what am i doing wrong when it comes to "m_myEditCtrl"? What do i replace it with?
Just a Human Trying to Live in a Computers World.
|
|
|
|
|
NewbieStats wrote:
C:\*\ClientDlg.cpp(190) : error C2065: 'm_myEditCtrl' : undeclared identifier
The m_ implies that it is a (CEdit ) member variable of the CClientDlg class.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
m_myEditCtrl is a CEdit member of your dialog class, declared in the dialog's .h file. You will also need to associate the member with an edit control in your dialog template.
You can do this dragging an edit control into your dialog template (using the resource editor) and using the ClassWizard to associate the CEdit member variable with the control.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Im still alittle Queued... In class wizard when i go to Member Variables the only Class ID's listed are "IDCANCEL" and "IDOK" the only choices i have are "Add Class" and "Add Variable"
When i click on Add Variable it says "Member Variable Name: m_" where im guessing i put m_myEditCtrl... the only Catagory is "Control" and the only variable type is "CButton" but i dont want it to be a button?
"m_myEditCtrl is a CEdit member of your dialog class, declared in the dialog's .h file." Where and what would i put in CButton01Dlg.h? (would this change my Class ID list to allow me to add it?
"You can do this dragging an edit control into your dialog template (using the resource editor)" Resource Editor?... Dragging an edit control into your dialog template?... Im so Lost =/
Sorry again...
Just a Human Trying to Live in a Computers World.
|
|
|
|