|
......the ") + 0.5)" is a integer conversion tactic i saw at vb-accelerator.com
as well...>>>that must do!!
it ensures the rounding up to the next number bcause the int-conversion just kills the fraction after the '.' - Ha!
|
|
|
|
|
In MFC is there any way to Detect the currently playing song (mp3, mp4, wma, ra, wav, ogg, aac, aif)in a user's media player (iTunes, Windows Media Player, Winamp, Real, Napster etc.)
:->
|
|
|
|
|
Hey,
i want to read and write a .csv file using CFile. the records are like the following:
1.tif,Transferred,12:00-12:10,10KB/S
2.tif,Transferred,12:30-12:40,10KB/S
3.tif,Transferred,13:00-13:10,10KB/S
how can i load the contents into a CString and how can i read content line by line into a CString by using CFile class?
CFile::GetLength resturns the length of the file. but, if i define a buffer[length] to load the data, i found that the last few chars of the array are mass things.How does this come?
Thanks a lot!
|
|
|
|
|
a_du wrote:
want to read and write a .csv file using CFile.
Instead of CFile use it's derived Class CStdioFile,as it's Member Function CStdioFile::ReadString read file LINE by LINE
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
I guess you should use CStdioFile instead of CFile and use function like ReadString and WriteString. Then use Tokenize function of CString to parse the data.
a_du wrote:
if i define a buffer[length] to load the data, i found that the last few chars of the array are mass things.How does this come
<br />
byte buffer[length + 1];<br />
buffer[length] = '\0';
http://www.priyank.in/
|
|
|
|
|
Hey , i got a small tiny littile Question...
which is:
string string1;
string string2;
i wana check if da first 10 char in string1 == da first 10 char in string 2
how can i write that in c++??
Sorry for bothering ,
My regards,
Bahy
|
|
|
|
|
using std::string;<br />
<br />
int main()<br />
{<br />
string a("1234567890INTEL");<br />
string b("1234567890AMD");<br />
<br />
if(10 > a.length() || 10 > b.length()) {<br />
std::cout << "Length.\n";<br />
return 0;<br />
}<br />
<br />
std::cout << a.c_str() << "\n";<br />
std::cout << b.c_str() << "\n";<br />
<br />
int res = a.compare(0, 10, b, 0, 10);<br />
std::cout << "res = " << res << ".\n";<br />
<br />
return 0;<br />
}<br />
Maxwell Chen
|
|
|
|
|
One way would be to copy out the 10 characters in each string before comparing
char szStr1[11], szStr2[11];
strncpy(szStr1, string1, 10);
strncpy(szStr2, string2, 10);
szStr1[10] = '\0';
szStr2[10] = '\0';
if(strcmp(szStr1, szStr2) == 0)
{
}
<font=arial>Weiye Chen
Life is hard, yet we are made of flesh...
|
|
|
|
|
thanks u soo much ..bt it gave me an error at those lines
strncpy(szStr1, string1, 10);
strncpy(szStr2, string2, 10);
and the error is
cannot convert parameter 2 from 'class std::basic_string<char,struct std::char_traits<char="">,class std::allocator<char> >' to 'const char *'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
SO what can i do??
My regards..
bahy
|
|
|
|
|
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
|
|
|
|
|