|
replace string1 with string1.c_str()
cheers,
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Thank You soooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo Much...
|
|
|
|
|
|
Hello My Teacher ,
Can i ask you 1 more question , (if u dont mind)
How can i ask the user to insert a string , and to be saved in Title
i believe if it was a char[30] i can use
char Title[30];
cin.getline(Title,30);
But what is the case if it String??
My regards,
Bahy
|
|
|
|
|
I thought ana was asking the C++ string type....
Maxwell Chen
|
|
|
|
|
or in just 1 line:
strncmp( string1.c_str(), string2.c_str(), 10);
|
|
|
|
|
Hey ,,thanks for da code , it really works fine...
but can u tell me what does it mean , cause i cant understand how it works..
My regards,
ana bahy
|
|
|
|
|
Hi i am using this code to Initialize a driver when the DLL is used.
I want it initialzse the driver when the DLL is used.
And when the DLL is exited or is not used no more the driver unloaded.
The problem i am having is, That whne it loads its fine, but when i unload the DLL. It loads the driver twice and then it displays unload. Can i somehow fix the double load and then load problem somehow?
void exitfkt(void)
{
MessageBox(NULL,"Unload Dll", "Test", MB_ICONINFORMATION | MB_OK);
}
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
MessageBox(NULL,"Load Dll", "Test", MB_ICONINFORMATION | MB_OK);
atexit(exitfkt);
return TRUE;
}
|
|
|
|
|
Cillieacc0rd5o4 wrote:
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
MessageBox(NULL,"Load Dll", "Test", MB_ICONINFORMATION | MB_OK);
atexit(exitfkt);
return TRUE;
}
change it to..........
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch(ul_reason_for_Call)
{
case <code>DLL_PROCESS_ATTACH</code>:
MessageBox(NULL,"Load Dll", "Test", MB_ICONINFORMATION | MB_OK);
break;
case <code>DLL_PROCESS_DETACH</code>:
atexit(exitfkt);
break;
}
return TRUE;
}
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
say you have a base class
class base
{
public:
[vars]
[funcs]
virtual void func()=0;
};
and child class that inherits the base but adds some of its own variables and functions
class child: public base
{
public:
[more vars]
[more funcs]
void func() {[statements]};
};
if you then were to declare, use, and release as follows, is there a memory leak, or other problem? It seems wrong to me, but I want to do it this way.
base* apple;
apple = new child;
apple->func();
delete apple;
Thanks for any help.
|
|
|
|
|
There's nothing wrong i believe. Just make sure your child class has a virtual destructor to clean up whatever memory allocations you made in it.
<font=arial>Weiye Chen
Life is hard, yet we are made of flesh...
|
|
|
|
|
Hi,
I am jagadishg doing M.Tech in I.I.T Kharagpur.currently i am working on audio programming. I am in need of your help to "Finding the Missing PCM samples". so i need the source code either in c/c++.
I tried in MAT lab, using sine wave generation,there i experiment by missing some samples.
so kindly help me to find out this thread.
thanks in advance.
Jagadish
|
|
|
|
|
Hello All,
I am working on screen saver, which need to display an Image in different ways i.e. coming from bottom/top , fading in or fading out or more. I would love to make these by my own, But i have no time left to do so and deadline is approaching , So i am going after any ready made solution offcourse with Source Code!.
Please somebody point me in right direction to accomplish above task! thanks
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
Hai..
I am hooking the wordpad application. I have typed some text in the wordpad. Now i want the fontname of the text.How to get that.Please let me know.
Thanking you,
e.veera raghavendra
|
|
|
|
|
Veera Raghavendra wrote:
wordpad application. I have typed some text in the wordpad. Now i want the fontname of the text.How to get that.Please let me know.
If you are hooking the wordpad application, you must have the handle of RichEditCtrl Window.now using that handle and EM_GETCHARFORMAT message you can retrieve current fontname of text at cursor position
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
Hello every 1 ,
i am using infile to load lines from a saved file as follow
infile>>Title;<br />
infile>>Date_Time;<br />
infile>>Content;
but the problem if any of them got spaces , it will stop at the first space , while i want it to infile the complete line no matter what it find.
cause now i cant use space ....please help
|
|
|
|
|
Use getline[^], which means you can specify the delimiters ( characters that cause input to stop ).
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
ana_bahy wrote:
i guess u ment :
infile.getline(30)>>Title;
No, instead of guessing, read the link I gave you.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Thanks sir , i did not that it was a link ..
but even though i did not find what i want .. i kept searching for 3 days
I ment i wana load a line from a file , and not to be inserted by me .
and each loaded line , will be saved in char[];
so could u plzzzzzzzzz help ?
|
|
|
|
|
The error you got was that no overloaded function takes one parameter. Do you know what that means ? It means that
infile.getline
exists, but you're using it wrong. According to the docs that I linked you to, getline takes 2 or 3 parameters, a char * and a size, and an optional char to denote a delimiter. Therefore.
char * line = new char[1024];
infile.getline(line, 1023, 13);
will read a line up to 1023 characters, ending in a return character.
I'd be inclined to use the string one though, on reflection
Here is a code sample to do what you want
vector<string> vec1;
string line;
vec1.clear();
ifstream infile ("stl2in.txt");
while (getline(infile,line,'\n'))
{
vec1.push_back (line);
}
It assumes at the top of your file you have
#include <iostream>
#include <fstream>
#include <string>
#include <vector>
using std::string;
using std::ifstream;
using std::getline;
using std::vector;
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi, all
I am amateur in using programming language. I'm doing a project to get a string which is inside the Windows Registry. Would anyone please present here the entire script of codes, including all functions or all the .cpp and header files. As I have copied some functions in here, but still have no idea on how to make it compilable. I would greatly appreciate your help. Thanks.
~~~ Landy
|
|
|
|
|
Search this site for CRegistry, there are at least two classes here of that name which will do anything you might want, and if you look through the code, will show you how it is done.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
akayoku wrote:
As I have copied some functions in here, but still have no idea on how to make it compilable.
And what does your code look like?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I don't know why. After I have donwloaded the code and included all header file, it always has a compile error which states:
fatal error C1083: Cannot open include file: 'stdafx.h': No such file or directory
Error executing cl.exe.
What is the matter with "stdafx.h"? Indeed, I can't see this header file in the directory, but even if I copy the "stdafx.h" into the directory, it still can't work. It would just pop up even more errors like:
Cannot open include file: 'afxwin.h': No such file or directory
Error executing cl.exe.
Suddenly, more and more header files are needed. Would anyone tell me what to do?
|
|
|
|
|
akayoku wrote:
fatal error C1083: Cannot open include file: 'stdafx.h': No such file or directory
Error executing cl.exe.
Your code does not use precompiled headers, but the code you're imported does. Just remove the include for this file in the code you've added.
akayoku wrote:
Cannot open include file: 'afxwin.h': No such file or directory
Error executing cl.exe.
These headers are included by stdafx.h. Just remove the include for stdafx.h ( or check to see if your project is set up to use precompiled headers, in which case, change it ).
Christian Graus - Microsoft MVP - C++
|
|
|
|