|
How to use this function
<br />
char *m_Name=new char[256];<br />
DWORD Lenght=255;<br />
GetLogicalDriveStrings(Lenght,m_Name);<br />
...<br />
...<br />
-- modified at 10:25 Wednesday 6th September, 2006
|
|
|
|
|
WhiteSky wrote: How to use this file
What file?
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
function
|
|
|
|
|
Fair enough. But the OP already knew how to use the function. He was troubling parsing the resulting buffer.
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Each drive letter is separated by a nul character. Try:
char szDrives[105] = {0};
GetLogicalDriveStrings(sizeof(szDrives), szDrives);
char *pToken = szDrives;
while (*pToken != '\0')
{
cout << pToken << endl;
pToken += 4;
}
"Talent without discipline is like an octopus on roller skates. There's plenty of movement, but you never know if it's going to be forward, backwards, or sideways." - H. Jackson Brown, Jr.
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Is There any short way to remove some lines from a file say there is a file called
Hello.dat contains 5000 lines
1) In that i just want read first 200 lines
2) Preform some operation
3)remove them i.e. 200 lines if the operation is proper //This is the problem
Some efficient was i.e. without creating another file i.e. new file
Payal
|
|
|
|
|
payal335 wrote: Some efficient was i.e. without creating another file i.e. new file
you have too make a new file for this.. there is no other option!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
payal335 wrote: Is There any short way to remove some lines from a file say there is a file called
Hello.dat contains 5000 lines
1) In that i just want read first 200 lines
2) Preform some operation
3)remove them i.e. 200 lines if the operation is proper //This is the problem
CFile::SetLength is one option, but you will have to do some additional work like counting the number of lines ( in your case 200 ).
|
|
|
|
|
Unfortunately, it seems the Operating System does not allow shortening of a file by removing data at the beginning. It only allows truncation of the tail. Therefore I think it is not possible to solve your problem without read and write operations (on the same or two files).
But I would consider the following approach. The first value of your file should be reserved: it will contain the position of the first line that should be read. After you read your 200 lines, simply rewrite the first value. These lines are still in the file, but are ignored on next operations.
So you have to deal with GetPosition and Seek members of CFile .
Instead of storing the position in the same file, you can store it in a separate file or in memory.
This way the file will grow when you append new lines, therefore you should really remove unneeded head lines periodically.
I hope this helps.
|
|
|
|
|
Thank you all for putting u r valuable time
payal
|
|
|
|
|
Hi,
I have data as log file, then i want to display that data in tabler format. so how can i do in my vc++ application.
Also I want to use bar chart and it should be support event. so what kind of chart control can I use.
please reply me if anybody know.
partha.s@papyrus.ne.jp
bye
parthasarathy
|
|
|
|
|
victorsarathy wrote: so what kind of chart control can I use.
please reply me if anybody know.
try google[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Hi All,
I am unable to work out the reason for the extra consumption of memory in the following code. This is just some code I was experimenting with. I am using the winldap libraries.
void TestInitialisation()
{
//LDAP* ldap = ldap_open(NULL, NULL);
LDAP* ldap = ldap_init(NULL, NULL);
if(ldap)
{
//ldap_set_option(ldap, LDAP_OPT_ROOTDSE_CACHE, LDAP_OPT_OFF);
//ldap_set_option(ldap, LDAP_OPT_CACHE_ENABLE, LDAP_OPT_OFF);
ldap_unbind(ldap);
}
else
assert(false);
}
The lines that I have commented are the options that I have tried, but they dont seem to make any difference. I also noticed that consequitive calls to TestInitialisation() will result in a leak too, but the number of calls to get a leak happening is not consistent. I found it useful to write up a small dialog application with a button press event that called TestInitialisation().
I would appreciate any ideas and help on this.
Thanks,
|
|
|
|
|
Is this code in a loop? if so did you remember to call ldap_unbind() . Each time you call ldap_open() you are creating a new handle, so unless you close it you will have a handle leak. You could also try adding static to the ldap_open() line, which would cause it to only be called on the first loop.
|
|
|
|
|
Hi all:
I'd like to avoid the reboot while installing the MSI package, I have some clues but they are not worked as expected.
MsiInstallProduct(szPath, _T("REBOOT=ReallySuppress"))
After executing the above line the system rebooted without any warning. How can I really suppress the reboot?
|
|
|
|
|
Problem solved
you have to add the "ACTION" property too
So, final statement will be
MsiInstallProduct(szPath, _T("ACTION=ADMIN REBOOT=ReallySuppress"))
|
|
|
|
|
When i run m program i got this erroe how to solve this
C:\myproject\wartz_new\wartz_newDlg.cpp(194) : error C2039: 'GetLineCount' : is not a member of 'CString'
This is the sample code
<br />
m_MainEdit=m_MainEdit+"<Session ID :>" + sessionid +"\n";<br />
UpdateData(FALSE);<br />
iLineCount=m_MainEdit.GetLineCount();<br />
m_EditCtrl.LineScroll(iLineCount);<br />
|
|
|
|
|
I don't know what you are trying to do but a CString object is 'just' a string. So, there is no information about line count.
|
|
|
|
|
yes because CEdit::GetLineCount
|
|
|
|
|
and i guess you need to CString::GetLength
iLineCount=m_MainEdit.GetLineCount();
iLineCount=m_MainEdit.GetLength();
|
|
|
|
|
|
You created a member variable not a member value!
An easy mistake since the menu items are next to each other.
Elaine
|
|
|
|
|
Dear All
I write a program to read data from parallel port.
This program is a monitoring program and should work 24 hour per day.
I use following major functions to create and have inter process communication in my project.
AfxBeginThread
SetEvent
WaitForSingleObject
But after a while, I find that the system becomes very slow and dont respond to user requests . (Mouse movement and keyboard typing become very slow)
After running the program I dont have this problem for 5 or 6 hours but after that the problem begins.
Please give me any information in this regards
Best Regards
Mahdi
|
|
|
|
|
It is difficult to say like that. It looks like you have a little memory leak somewhere and that it gets called over and over again. So, the effects appear only several hours later, when the memory usage has increased too much.
To check if this could be the problem, use the task manager to monitor your memory (not very precise but in this case, it will give you enough information to see if this is a memory leak or not).
|
|
|
|
|