Reem asks:
When I'm using : #include <iostream.h> #include<fsteam.h> #include<string> using namespace std;
I'm getting this error:
error C2872: 'ostream' : ambiguous symbol
How can I solve it???
Answer:
The C iostream library <iostream.h> cannot interoperate with the C++ iostream library <string>. Decide on a language to use and stick to it. If you want to program in C++, use
#include <iostream> #include<fsteam> #include<string>
(header files without the .h)
Also, I would suggest not using the "using namespace std". In my experience, it negates all benefit of using namespaces.
Michael S. Scherotter 12/21/2003
Luk asks:
How can I take info about running proces or programs in windows 2000/XP?
Answer:
You would use the Win32 API ::EnumProcesses() and the for each process you could call functions like ::GetModuleBaseName() and ::GetModuleInformation(). Check out Microsoft's documentation for PSAPI
Michael S. Scherotter 7/10/2003
M2TM posted a follow up to my answer to Stephen's question about decompiling:
Anyhow, you -can- decompile programs into the language they were written in,(just as you can disassemble them into assembly) though you generally have to know which language the original was made in. Hackers and Crackers do it all the time to figure out registration keys. I've got an entire book on stuff like that called "Crackproof your software" by Pavol Cerven, I'd suggest taking a gander.
Basically, in poor, hopless Stephen's case, if it was coded
in c++ then yeah, it's possible, it may not be clean code, but
you can do it. generally, the further you get from assembly code,
the harder it is to re-create the code in the language that was
used. Visual Basic 5.0 code is nearly impossible to de-compile
compared to C++ code (which is much closer to the machine's language)
for example.
M2TM 6/8/2003
Phani asks:
how to implement image compression in c++
Answer:
There is no single way to implement image compression in C++. Rather than reinvent the wheel, I would suggest using code that someone has already written and debugged. If you are using windows, you can use GDI+ from Microsoft which has built-in support for compression of JPEG,PNG, and GIF files. Otherwise, take a look at these resources.
Luis asks:
Hi expert, I don´t know how can I read a video file and
show its wide and length and duration of that video.
Answer:
This depends on the format of the video file. Some formats require licensed components to read and some formats do not. There is no easy answer to this one. Take a look at these search results.
Hi,
I have a hobby type project that I am trying to put together,
and I am wondering if you know of any way that you know to "decompile"
it and tell me how it does works so I can write something similar
to it and make my homebrew device operational. I know that this
is not easy but I have aready found a way to put it into "assembley"
language, but that is a low level language? or something that
that and it is hard to interpret and write back into C++. ANyways,
i am basically and ham radio /computer nerd who is somewhat into
computers, but not to this extent. I have done my homework, but
everybody that I talk to says that it can't be done (college friends)
but when I go on the forums people say it can be done but only
somebody who is highly skilled in this area. Any haelp would be
gladly apprieciated .
Thanks
Steve Calabrese
Answer:
As far as I know, compiling is a one-way street. Making a program strips out all of the human-understandable organization. Read this for more info.
Michael S. Scherotter 5/20/2003
I have developed a program in c language using biosdisk() to
directly read and write the sectors in hardisk. As it is a 16-bit
program it runs fine on windows95/98. It needs to be converted
to 32-bit for running in windows2k. I don't know how to convert
it in vc++. Even i have used some free 32-bit compiler, but it
doesn't work. Please provide me a solution for this.i badly need
your help
with regs,
B.Anandh
Answer:
I have never used biosdisk(), but that would only work for Fat16 and Fat32 formatted disks, not NTFS disks which are common on Windows 2000. Try compiling the source code on a 32-bit compiler. Your statement, "It doesn't work" is a little to vague to offer a solution. Post a follow-up question with more exact descriptions of your errors.
Michael S. Scherotter 4/22/2003
Hils asks:
Is it possible to represent data graphically in a dialog based application?
I have a datafile containing locations of items which I am sampling and have so far managed to get the contents displayed as text in a dos window. I want to be able to display these locations on a graph in a dialog based application (as I wish to have a number of buttons so am assuming this is the simplest way of doing it) but cannot work out how to a) define an area in the application for the information to be displayed or b) display it
Any suggestions would be greatly appreciated,
Thanks,
Hils
Answer:
Though you do not specify what libraries and platforms you are building this on, here is a solution using MFC:
Michael S. Scherotter 3/8/2003
Is there a way of passing multidimensional arrays with one
dimension specified as a variable (e.g. x=3; array[x][4] ) into
a function, where the data may be changed, and then back again?
I have only managed to pass a multidimensional array this way
when both dimensions were expressed (e.g. array[3][4]).
A prompt responce would be greatly apreciated.
Thank you, James Alves (Year 4, University of Bristol, UK)
Answer:
You can access and modify elements of a a multi-dimensional array in a function if you treat the array as a single dimensional array and advance the pointer to the element that you want to access. In this example, I modify the element theArray[3][4] in the function ::SetTo12() by advancing the array pointer.
#include <iostream>
// If you want to access any element in a multi-dimensional array, pass a pointer to the
// first element and advance the pointer to the position of the element that you want to change
static void SetTo12(int* pArray, int nXSize)
{
pArray += (nXSize * 3) + 4;
*pArray = 12;
}
int main(int argc, char* argv[])
{
int theArray[10][12];
::memset(&theArray, 0, sizeof(theArray));
std::cout << "Before: " << theArray[3][4] << std::endl;
::SetTo12(&theArray[0][0], 10);
std::cout << "After SetTo12: " << theArray[3][4] << std::endl;
return 0;
}
Michael S. Scherotter 1.12.2003
Minwoo asks:
How do I do things on C++ such as:
1. updating C++ executed programs on my website.
2. making a running C++ program automatically go to a certain website i want. From there, if the site has a textbox, how would i make C++ automatically type an assigned "character" in it?
3. If there was a Submit button on a webpage, how can I make C++ automatically press it?
Thanks.
Answers:
Michael S. Scherotter 1/2/2003
Minwoo asks:
How can i make .cpp files run as .exe files?
What i mean: i want to run the complete program on computers that don't have C++. How do i do that?
Answer:
You cannot. The cpp file needs to be compiled by a compiler and linked by a linker before it can be run as an executable. Use an interpreted language such as VBScript or Javascript for that.
Michael S. Scherotter 1/2/2003
