|
If you right-click on the #include < math.h > statement and select Open Document, does that work? Is the sin() prototype found in the file?
|
|
|
|
|
Thanks for your help.
I discovered that by moving the #include from the .cpp file to the .h file, this made VC++ happy. I'm not sure why it wouldn't "see" math.h from the .cpp file...but I'm happy that it works... and I suppose the .h file is the more organized place for the include.
/KL
|
|
|
|
|
either you're messing around with precompiled headers (everything befoer stdafx.h is basically ignored), with namespaces, or maybe you do use sin() in a cpp file that didn't have the #include.
For the "more organized place":
- includes used in most files go into stdafx.h (append at bottom)
- other includes go into .cpp unless they are needed in .h, or by files that include that header.
"Der Geist des Kriegers ist erwacht / Ich hab die Macht" StS
sighist | Agile Programming | doxygen
|
|
|
|
|
If your working on aproject with precompiled headers, the compiler will ignore all statements upto the
#include "Stdafx.h"
line, so if you had #include math.h before this line it would have been ignored, it has to be after that line and then all would be ok.
Roger Allen
Sonork 100.10016
Were you different as a kid? Did you ever say "Ooohhh, shiny red" even once? - Paul Watson 11-February-2003
|
|
|
|
|
Hiya I am writing records of lenght 100 in a file. I was just wondering when am I meant to use carriage returns and line feeds?? What is the advantages of putting them into ur files??
Is this a line feed = '\n' and is this the carriage return = '\r'??
So it would be:
char *line = "hello\r\n";
Also what is the difference between stream and ostream??
Thanks.
|
|
|
|
|
grahamoj wrote:
Hiya I am writing records of lenght 100 in a file. I was just wondering when am I meant to use carriage returns and line feeds?? What is the advantages of putting them into ur files??
There's no advantage per se. It's just a convenient way of delimiting the lines. Most, if not all, text-type controls treat the CR/LF characters appropriately, otherwise you could use any delimiting character but would have to convert that character to something else before displaying the data.
grahamoj wrote:
Is this a line feed = '\n' and is this the carriage return = '\r'??
Yes.
|
|
|
|
|
stream can be closed and then reopened so you can use it for input and output. As a result, there is no default argument, whereas an ostream always knows it is being opened for output.
Christian
NO MATTER HOW MUCH BIG IS THE WORD SIZE ,THE DATA MUCT BE TRANSPORTED INTO THE CPU. - Vinod Sharma
Anonymous wrote:
OK. I read a c++ book. Or...a bit of it anyway. I'm sick of that evil looking console window.
I think you are a good candidate for Visual Basic. - Nemanja Trifunovic
|
|
|
|
|
grahamoj wrote:
I am writing records of lenght 100 in a file.
If you know that your records are of length 100, then there is no reason to add CR/LF as a delimeter. In fact, there is no reason to delimit records of a fixed length.
If this is a binary file (holding just data for a program to read/write/process) then there is no need for CR/LF. If this is a text file that a person may want to look at, then CR/LF is nice to keep the lines separate, but only for someone to look at. If the file is text but is meant only for a program, then CR/LF isn't necessary.
Dave
"You can say that again." -- Dept. of Redundancy Dept.
|
|
|
|
|
For some reason, the "format selection" is always greyed in the edit menu.
any thoughts ?
Maximilien Lincourt
For success one must aquire one's self
|
|
|
|
|
Smart indenting is not turned on.
|
|
|
|
|
I've found some stuff here and elsewhere on how to get the IP address of each adapter card in your system. The problem is that I want to display the adapter's name and IP Address in a combo box so the user can select which one he wants to use. e.g. "3Com EtherLink 10/100 PCI TX NIC (3C905B-TX) at IP address: 184.23.22.101"
I have been unable to find an API or call that would correlate the two to each other. The first can be obtained in the registry in various locations depending on whether OS is Win9x or NT/2000/XP. Of course, it is unsorted in the registry. The second is GetIpAddrTable().
Does anybody know how I can get the same information and correlate it to each adapter card? BTW, I know how to detect dialup adapters (0.0.0.0) and don't display them. However, ironically, the 0.0.0.0 can be used for DHCP enabled adapter cards so there doesn't seem to be a way of getting the IP address of the card from the registry. Thus, the dilemna, I can get IP address from API calls but not in the registry. I can get adapter card device description from the registry but not the IP address.
|
|
|
|
|
Can you use GetAdaptersInfo()? This will give you the name of each adapter and the IP addresses it uses. Cross-referencing on either would be easy.
|
|
|
|
|
Thanks for your response. I did try that but the DeviceDescription I read in the registry does not exactly match what's returned in GetAdaptersInfo(). For example, here are my adapters DeviceDescription field read in the registry:
"3Com EtherLink 10/100 PCI TX NIC (3C905B-TX)"
"3Com 3C920 Integrated Fast Ethernet Controller (3C905C-TX Compatible)"
But, GetAdaptersInfo() only returns one of the adapters (one is probably no longer in my docking station):
"3Com Etherlink PCI"
Not an exact match. Though I could just search for "3Com Etherlink" how do I know how much of the string should I be looking for. I mean, if I did have my 3Com 3C920 controller still installed, would GetAdaptersInfo() return "3Com 3C920" or would it change it somehow, possibly "3Com 3C920 PCI"? I guess it could be done but I was hoping for an exact match returned from GetAdaptersInfo() or some other API call.
|
|
|
|
|
From what I can tell, GetAdaptersInfo() probably gets the name from the device driver itself. It first consults the registry to get the GUID, then cross-references that to get the name of the device driver file. This is just a guess based on my test app's registry access. As it did not obtain the name directly from the registry, I can only assume it used the device driver file.
|
|
|
|
|
If one or more resource IDs in a DLL are the same as what is in an MFC application that is being developed, will there be a problem?
The DLL is being loaded at run-time and there is a resource header being linked into the main application.
SJ
Manufacturing Software Developer
Hewlett-Packard Company
|
|
|
|
|
If you are using MFC I'm pretty sure you won't have a problem as it uses the hInstance for the DLL or the EXE as required. If you aren't using MFC then make sure you set hModule correctly in the call to LoadResource() or whatever you are using and you should be ok.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Unfortunately, yes.
I discovered this working inside the company I'm currently employed during the Veritest's "exam" for Windows 2000 Logo.
The problem occured having a central executable and a set of DLLs called from it.
Everything is MFC.
Suppose you have into dll 1 a string resource with IDC_STRING, and into dll 2 a string resource with ID = IDC_STRING2, and IDC_STRING1 = IDC_STRING2. If dll 1 is loaded, loading dll 2 will give in the point of IDC_STRING2 loading a call to FindResource with ID = IDC_STRING1 = IDC_STRING2. Most probably it will find it in dll 1 and load from there, since all are mapped in the same process. If you manually specify the dll instance, that's ok (I think...) but I don't think you call
::LoadString(hInstDll2, IDC_STRING2, szText, sizeof(szText));
instead of
CString str;
str.LoadString(IDC_STRING2);
or
AfxMessageBox(IDC_STRING2).
Things are even worse if you have different or custom resource types. I've seen several crashes so bad just because this resource clash.
In fact this made us to write a resource align tool that reads resource ranges for a dll.
The basic idea is to make a resource partitioning tool (parses .rc and rewrites resource.h) in such a way that:
ResourceIDs(dll_i) AND ResourceIDs(dll_j) = EMPTY
for any i <> j, 1 <= i, j <= n (number of modules using resources you have).
The thing may not be so simple as you think, there are external details to consider.
Think a MDI application that has to specify a CLIENTCREATESTRUCT's ID for first MDI child window. Accordingly to MSDN (and this one is true ) these IDs should not conflict with existing resource IDs. There may be other restrictions as well, I've pointed only one of the most obvious.
A dll starts with a default range of resources of 100.
If the internal parser decides that this is not enough, it will modify the input "ranges" file and adds a new 100 sized range and try to resort the IDs in such way that each resource ID will be placed inside that range. The process is performed until all resource IDs from dll have room in the allocated ranges.
A rebuild all is, of course, required after resource alignment.
In this way, there is no worry that a dll will ever have a resource ID conflicting with another dll's resource IDs.
Now we all live happily , having 3 different development offices compiling all in the same place over main website. The internal objects detects if there are resource changes, these MUST be recorded inside the task (I'm not going into details what a task means and how the website is working, but I think you get the point) and, if a module past outside the range, and automatic aligner component works in conjunction with resource parser tool to get a new range and resort affected resource.h.
Rebuild all (for the dll and all dependent modules) and that's it.
("That's it" = almost 3 months of work from time to time until we get the job done)
|
|
|
|
|
Is there anything better than 'atoi' when trying to convert ASCII to integers ?
It looks if I try to convert __int64 with aoti, it fails on the big numbers
Shay
|
|
|
|
|
|
I didn't even know it exists, I'll give it a try,
Thanks
|
|
|
|
|
Well,
It did not work....
I actually need to covner an __int64 to ASCCII , waht you gave me was the other way
|
|
|
|
|
|
Yep !!!
That did it, and I almost implemented it by myself....
Thanks
|
|
|
|
|
Another "tool" to keep in your box is the "%I64d" format specifier? Use it with sprintf().
|
|
|
|
|
I have the following line in my code:
sprintf(Tempcrap1, "%02d", Modi[i] - 64);
strcat(Tempcrap, Tempcrap1);
Where I am translating the alpha to numeric:
A-010,b-020,c-030 ....
for some reason I am loosing 0 after the numbers.
My result is:a-01,b-02,c-03... Where is the error?
|
|
|
|