|
no, that right...
except some particuliar cases, C++ IS a superset of C and so C code is understood and compiled by C++ compilers
TOXCCT >>> GEII power
|
|
|
|
|
fopen n stuff are CRT funtions they are available in c++ too.
I'll write a suicide note on a hundred dollar bill - Dire Straits
|
|
|
|
|
Please refer to Appendix B in the book "The C++ Programming Language, 3rd" by Stroustrup for...
B.2.2 C Code That Is Not C++, (Page 816)
B.2.4 C++ Code That is Not C. (Page 819)
Maxwell Chen
|
|
|
|
|
Maxwell Chen wrote:
B.2.2 C Code That Is Not C++, (Page 816)
B.2.4 C++ Code That is Not C. (Page 819)
No snippets
Awhh go on.. give us a clue what it says (briefly).
I Dream of Absolute Zero
|
|
|
|
|
RChin wrote:
No snippets
It's *A LOT* ~~~
Now you have some choices:
1) Go to a library to get that book,
2) Buy one (special edition) from a book store,
3) Download the whole book in pdf at HERE[^].
Don't tell Stroustrup that I posted his book in pdf here; otherwise he would probably spank me.
Maxwell Chen
|
|
|
|
|
I wasn't joking at all. Just because you need to move something from C to C++ doesn't mean you have to change everything to use only those things specific to C++. The code is perfectly valid C++ code as written. Why fix something that isn't broken? (better yet, why make something more bloated just so for appearances?)
(I've actually seen someone take the equivilant of:
int values[MAX_VALUES];
and turn it into:
vector<int> values;<br />
values.resize(MAX_VALUES);
)
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Hey,
Say e.g. you are using a SetTimer() to get frames from a video device.
I find It takes up all the CPU. How do people cope with this? I really want to get frames
as fats as possible but I also dont want the GUI or display to suffer. What do people do ?
Do they put a wait in the SetTimer call?
Regards,
|
|
|
|
|
try creating a seperate thread and wait there for as much time and try to grab a frame,
might work
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
|
|
|
|
|
They usualy use DirectX (DirectDraw) or OpenGL. If you must use SetTimer then only use it to invalidate the portion of the client area that needs changing OR use it to post a user defined message that instructs your program to load the next frame and let the function that handles that message invalidate the area. You should spend as little time as possible in the function used to handle the timer message (OnTimer). You should also look into using a thread to load the images in the backgound. While you're surffing look for code that is used to display .flc, .avi and .mpeg files, they may provide the answers you are looking for.
INTP
|
|
|
|
|
Hi
I am opening the com port for a printer device and it opens it even if the printer is not connected. More over it sends the data also to com port even printer is not there.
Can any body help me how can i detect the device is connected or throw an error if device is not connected or can detect something on the data is not receiving to the device?
Thanks
Shailesh
|
|
|
|
|
ports will connect regardless of the device connected or not, try to send some data and then wait for the signal from the printer, if no signal then raise error
if you just want to control the printer why not use the printer api
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 trying to perform some functions on a floppy. i created a handle for that floppy and tried to read the bootsector using ReadFile and WriteFile.
i would like to
Perform a directory listing of the current directory on the floppy
Change directories on the floppy
Create directories on the floppy
Delete directories on the floppy
please show examples if possible or give link to any helpfull website on accessing a floppy disk
|
|
|
|
|
Assuming you have a drive letter for the floppy, the following functions will work.
FindFirstFile / FindNextFile
SetCurrentDirectory
CreateDirectory
DeleteFile , or SHFileOperation
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
I have run into some problems while trying to write a scripting language in VC++ 7. I want it to all be in an edit box. For example, if the user types this in the edit box:
String MyString = "Hello";
if (MyString == "Hello")
sendkeys(Hello);
else
MoveMouse(160,480);
end;
Quite a pointless program, but I am having a hard time handling it with C++. How do I handle the boolean logic, and how would I get both of the parameters of the MouseMove function. I would like the program to execute from the top to the bottom. Anyone have any idea how to do this? I just need the basic idea of how to do it. Any help would be appreciated
-Dev578
|
|
|
|
|
writing an interpreter is a huge task. if you don't know where to begin, you're much better off using an interpreter that's already written.
there are free interpreters for many languages out there, including things like VBScript, Tcl, Lua, Python, Ruby, etc.. try Google.
Cleek | Losinger Designs | ClickPic | ThumbNailer
|
|
|
|
|
Chris is right. It's really a huge task. But if you insist, books like this kind would be very helpful to you : Writing compilers and interpreters[^]. After all, innovation drives the world to get better and better.
Maxwell Chen
|
|
|
|
|
Might anyone know why the following line works in WinXP but not in Win2000
<br />
pMyDocTemplate->OpenDocumentFile( NULL ); <br />
In windows2000 apparently it's telling me there isn't a dialog template.
An interesting note is that, if I create a new document through the toolbar, close the document, then call this method again, it will work. Puzzled by this.
Thanks!
|
|
|
|
|
You're using the same binary on both Windows XP and Windows 2000, and the same version of the MFC DLL?
Is the Windows 2000 system running Service Pack 4? The DLL Help Database[^] indicates that Windows 2000 SP4 shipped a new version, 6.0.9586.0, of mfc42.dll . If you're compiling with MFC 6.0, supplied with Visual Studio 6.0, this might (potentially) be causing the problem. An even newer version, 6.0.9782.0, ships in Visual Studio 6 Service Pack 6.
Exactly what problem occurs? Do you get an ASSERT failure, or an error message? Is the behaviour consistent across Debug and Release builds?
If you get an ASSERT, what source file and line is listed? If you get an error, what is the exact error message?
[edit] Are you using a CSingleDocTemplate , a CMultiDocTemplate , or your own class derived either from one of those or directly from CDocTemplate ? [/edit]
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Hi, I have some functions written in C# I want to use in Win32 API program (C++ used).
How can I do it. If someone can give me a sample code or direct to the some tutorial.
Thanks
|
|
|
|
|
The 'easy' way - use the regasm tool to export the C# class to COM. Use COM to load the C# code and call it.
The harder way - decompile your C# code with ildasm , add the appropriate declarations to the IL to get the CLR to generate flat exports (as in a traditional C DLL) and recompile with ilasm .
The really hard way - investigate the CLR hosting interfaces.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
|
Does anyone know whether it's possible to recognize right clicks with the CButtonST class developed by Davide Calabro? I know that you can declare a function
afx_msg void OnButton(UNIT nID)
in order to handle left-clicking a button, but can a similar process be applied for a right click? If anyone knows how to do this, please let me know.
~David
|
|
|
|
|
Is there a way that you can attach a command-line parameter on the end of an url? I want to send someone a hyperlink that will open up an .exe - that part works fine, but I also want them to be able to send 2 parameters, (the name of two text files). Is there any way to do that?
If it's broken, I probably did it
bdiamond
|
|
|
|
|
just append the variables to the end of the URL. THey will be ignored if not needed.
so if the URL is "http://this.com/that.exe" just change it to "http://this.com/that.exe?VAR1=foo.txt&VAR2=bar.txt"
Glano perictu com sahni delorin!
|
|
|
|
|
thanks, but are VAR1 and VAR2 going to be automatically recognized?
If it's broken, I probably did it
bdiamond
|
|
|
|