|
Rakesh5 wrote: Do we have any unicode equivalent to this _chdrive function?
_chdrive is completely independent of UNICODE, since it accepts an integer as argument (and not a string).
Rakesh5 wrote: Previously it was having the value of 28 but now the value is 35.
Which value are you talking about ? The return value of _chdrive ? That's impossible since it returns either 0 or 1.
Please clarify your question...
|
|
|
|
|
Hi,thanks for the reply...
int a = theApp.m_Dir[0]-'A'+1 ;
Can you please tell me what is the logic behind using 'A' + 1 ;
Can you help me??
Thanks,
Rakesh.
|
|
|
|
|
Rakesh5 wrote: Can you please tell me what is the logic behind using 'A' + 1 ;
You wrote the code but you don't understand what you wrote ??
Anyway, you are taking the first letter of the m_Dir string (which is probably a drive letter) and substracting the value of 'A'. This is because the letter 'A' has a specific ASCII code (which is not 1) but the A drive should be 1. Then you are incrementing the drive number by 1.
|
|
|
|
|
actually i did not write the code..my seniors have written.. am trying to learn what they have used ..
anyway thanks alot for your help...
rakesh.
|
|
|
|
|
Rakesh5 wrote: actually i did not write the code..my seniors have written.. am trying to learn what they have used ..
So use the debugger to see what the value of a is.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
finding prime nos. with an algo having time complexity of O(n)???
|
|
|
|
|
This sounds like a very good question for Google.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi,
I would like to know if there are any ways to programmatically detect or monitor the file or folder being copied either by copy command(like on command prompt-- copy a b) or by using drag/drop(ctrl+c and ctr+v).
It would be helpful if you could give some pointers( preferably some APIs in vc++)
thanks and regards
Dinakara K
Dinakara K
CAIR, Bangalore
|
|
|
|
|
You would probably need a File System Filter Driver for this.
Not a very easy task.
Look at the FileSpy sample in the Windows Driver Kit (WDK).
|
|
|
|
|
Thanks for the quick reply.I will look at FileSpy.....
Dinakara K
CAIR, Bangalore
|
|
|
|
|
I want to build an application with publish/subscribe model for UDP communication for a real time simulation system. I'm new to this communication model and need to know much about the publish/subscribe model. We are using the Client/Server model for the communication. Where can I get some details about this model and what is the middleware I should be using.
Thanks
Vijeesh T
|
|
|
|
|
Member 4599406 wrote: Where can I get some details about this model and what is the middleware I should be using.
I bet Google has lots of information.
|
|
|
|
|
GetOpenFileName() is Win32 API function which accepts a pointer to a OPENFILENAME structure. In this structure, you have to set up a member lStructSize to sizeof(OPENFILENAME) for Windows XP and above. But for Windows98 it must be OPENFILENAME_SIZE_VERSION_400. When I use an if statement to do it, compiler gives fatal error and stops :
OPENFILENAME ofn;
if(win98()==FALSE)
ofn.lStructSize = sizeof(OPENFILENAME);
else
ofn.lStructSize = OPENFILENAME_SIZE_VERSION_400;
Ofcourse I can make seperate functions for opening files in win98 etc. But what is a better way to do this.
Thank you
|
|
|
|
|
What is the error that you get?
|
|
|
|
|
This is what Pelles C Compiler displays :
Building MAIN.obj.
C:\Code\Hasher\MAIN.C(34): fatal error: Internal error: get_rule().
*** Error code: 1 ***
Done.
|
|
|
|
|
From the code that you pasted, I'm not able to figure out what the problem is.
The if condition looks perfect.
Is that on line 34 of main.c?
|
|
|
|
|
Yes. Its line # 34 in main.c
When I remove if statement and just set lStructSize to one of the values, the code compiles perfectly.
|
|
|
|
|
It seems that there is nothing unusual.
Give it a try by changing the name of the function "win98". It might confuse the compiler?
|
|
|
|
|
What does the win98() function do?
|
|
|
|
|
I am trying to sort a list using the insertion sort algo, but my application crashes. I think those pointers lost track by using the remove function. Is there a better way to sort except using the sort() (list.sort() function). It does not work too well with it since I am sorting by Departure Time of the object in the list.
Here is the code i wrote:
//Insertion sort to sort runs by departure time in the Res_RunList
int numruns = Res_RunList.size(); //the size of the list
ListOfRuns::iterator Tempitr1; //create itr poniters to navigate thru the list
ListOfRuns::iterator Tempitr2;
ListOfRuns::iterator Tempitr3;
ListOfRuns::iterator Tempitr4;
ListOfRuns::iterator Tempitr5;
ListOfRuns::iterator Tempitr6;
std::list <RDLRun*> TempList;
ListOfRuns::iterator Tempitr7;
Tempitr1 = Res_RunList.begin(); //points to the 1st element
Tempitr2 = Res_RunList.begin();
Tempitr6 = Res_RunList.begin();
for(int low = 1; low < numruns; ++low)
{
++Tempitr2; //points to low position
RDLRun *TempRun = (*Tempitr2); // store the data from low position in TempRun
int u = low -1;
Tempitr3 = Tempitr2;
Tempitr4 = Tempitr3--; //ponits to u position
//compare the time windows
while(u >=0 && ( (*Tempitr4)->GetDepartureTime() > TempRun->GetDepartureTime() ) )
{
Tempitr5 = Tempitr4;
Res_RunList.insert(Tempitr5++, (*Tempitr4));
Res_RunList.remove((*Tempitr5++));//to prevent duplicate
--u;
--Tempitr3;
}//end while loop
if(u > 0 || TempRun->GetDepartureTime() > (*Tempitr1)->GetDepartureTime())
{ Res_RunList.insert(Tempitr4++, TempRun);
Res_RunList.remove((*Tempitr4++));
}
else{
Res_RunList.insert(Tempitr6++, (*Tempitr1));
Res_RunList.remove((*Tempitr6++)); Res_RunList.insert(Tempitr1, TempRun);
}
}//end for loop
Thanks.
|
|
|
|
|
I don't see you using sort in your code.
Also, any insertion or deletion in the list renders the iterators invalid.
This can give you unexpected results.
|
|
|
|
|
Do you know of any better way to approach this scenario? Sort those objects in acending order by within a list?
Thanks.
|
|
|
|
|
The best approach is to use TempList.sort(MyCompare<RDLRun*>());
Here MyCompare is a functor used to decide how to sort the list of RDLRun class pointers.
|
|
|
|
|
Thanks for the insight. I have create a little functor to work with the sort function but getting an error. there is something that I am not doing right. Thanks for your help.
Functor code:
bool RDLTemporaryResource::SortByTime:public std::binary_function<RDLRun*, RDLRun*, bool>
{
bool operator() (RDLRun* a, RDLRun* b) const
{
if( a->GetDepartureTime() < b->GetDepartureTime() )
return 1;
else return 0;
}
}
Compiler error message:
--------------------Configuration: fstool - Win32 Debug--------------------
Compiling...
TEMPRES.CPP
c:\program files\ilps\code\fstool\tempres.cpp(837) : fatal error C1001: INTERNAL COMPILER ERROR
(compiler file 'msc1.cpp', line 1786)
Please choose the Technical Support command on the Visual C++
Help menu, or open the Technical Support help file for more information
Error executing cl.exe.
fstool.dll - 1 error(s), 0 warning(s)
|
|
|
|
|
Hi
i use ado to get data from database in vc, but now i want to let the data displayed in ms-word ,and then i can print
i just want to use word, no crystal report
pls give me some suggestions or materials
or complete steps to let data displayed in ms-word
i need help
thanks a lot
Sincerely
|
|
|
|