|
Thanks!
i couldn't think this silly logic!
i was just wandering if any funtion exist to show end of file !
anyway thankyou!
|
|
|
|
|
There are several methods to read a file. You can use C functions like fopen, fread, etc.. alternatively you can use file streams of C++ and also you can use Windows APIs
If you're using Windows APIs please check the following sample
ReadFile Sample[^]
-Sarath.
"Great hopes make everything great possible" - Benjamin Franklin
|
|
|
|
|
int _eof(
int fd
);
_eof returns 1 if the current position is end of file, or 0 if it is not. A return value of –1 indicates an error;
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
CStdioFile cFileObj;
CString strFilePath;
strFilePath = "C:\\Documents and Settings\\Desktop\\Test.txt";
// Open the selected file in Read mode
cFileObj.Open (mstrFilePath, CFile::modeRead))
now tell me how to use _eof
|
|
|
|
|
|
Don't use _eof if you are using CStdioFile.
Check this out:
CFile::Read returns the actual number of bytes read. If this number is less than the bytes requested, then the end of file has been reached.
CStdioFile::ReadString returns a NULL pointer when the end of file has been reached.
so when ReadString returns NULL you know the end of file is reached else continue with your usual functionality.
Hope it makes sense for you now...
kapardhi wrote: now tell me how to use _eof
(PS) Had you filed the details properly mentioning that you are using CStdioFile I would have offered the right solution in the first go...
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Hi all,
I need to delete registry key values in VC++.
I want to delete the values of :: HKLM->SYSTEM->MountedDevices
Please suggest me by providing the code hints.
Thanks.
|
|
|
|
|
Try CReg class within ATL. It offers you so many handy functions.
|
|
|
|
|
hello
this may help you! Try it!
To delete the value and the key it self
::RegDeleteKey((HKEY)hKey,(LPCWSTR)szKey);
here HKEY is HKLM
szKey is resst of the path i.e SYSTEM->MountedDevices
to delete value of key
open the path
OpenKey (LPCTSTR hKey, LPCTSTR szKey)
here HKEY is HKLM
szKey is resst of the path i.e SYSTEM->MountedDevices
then
RegDeleteValue(mhKey,(LPCWSTR)lpValueName)
i hope this will work
|
|
|
|
|
Thanks for replying,
I need to delete all values of MountedDevices key. So To delete them one by one I need to put it in to a loop, so how can I know the no of values that are there.
RegDeleteValue(mhKey,(LPCWSTR)lpValueName)
in this function lpValueName I need to pass the value name one by one. But I want to delete all values so that it will take the next value itself.
Thanks.
|
|
|
|
|
Better delete the whole key and then create it with new sub keys but having same old names
|
|
|
|
|
Madan Chauhan wrote: I need to delete all values of MountedDevices key.
Have you considered RegDeleteKey() ?
Madan Chauhan wrote: So To delete them one by one I need to put it in to a loop, so how can I know the no of values that are there.
Did you search MSDN? Look for RegEnumValue() .
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
You may use RegDeleteValue function!.
RegDeleteValue(hOpenKey,
sValueName);
Regards,
Rane
|
|
|
|
|
Thanks for replying,
I need to delete all values of MountedDevices key. So To delete them one by one I need to put it in to a loop, so how can I know the no of values that are there.
RegDeleteValue(mhKey,(LPCWSTR)lpValueName)
in this function lpValueName I need to pass the value name one by one. But I want to delete all values so that it will take the next value itself.
Thanks.
|
|
|
|
|
|
Hello,
I have finished writing ftp client in c/c++ using system funtion to get/put ftp commands
for example:
int FTPGet(char *asFtpSite, char *asFtpUser, char *asFtpPasswd, char* asRemoteDir,
char *asRemoteFile, char *asLocalFile, char *asLogFile)
{
char lsFtpCommand[4096];
sprintf(lsFtpCommand,
"export LANG=en_US\n"
"ftp -i -v -n >%s <<EOJ\n"
"open %s\n"
"user %s %s\n"
"ascii\n"
"cd %s\n"
"get %s %s\n"
"bye\n"
"EOJ\n",
asLogFile,
asFtpSite,asFtpUser,asFtpPasswd,
asRemoteDir,
asRemoteFile,asLocalFile);
system(lsFtpCommand);
return 0;
}
It works fine, but very slow, I found out it is why because i use "system" function,
What i want to ask from u, Is there any other method to make it faster?
I am told that there is a ftp library for C, which is cURL, somebody has ever tried it? or
Is There any other ftp library which works faster?
My platform is IBM AIX unix.
Thanks in advance
It is never late to learn
|
|
|
|
|
I havnt used libCurl, there's also libwww http://www.w3.org/Library/[^] which also looks promising...
you say its slow, and thats becuase you use the 'system' function .. what do you mean by slow ? I would have thought that once a shell had been spawned using system it could handle that easily, unless it does a truckload of parsing etc to read the commands from stdin/the input 'stream'
Is your system having other difficulties, like with memory or network connection issues ?? I'll see if I can test it on Solaris tomorrow...
|
|
|
|
|
Thanks for reply.
What i mean by slow was that when u want get file from ftp server and save it to your localhost or such operations works very slow, and i think it is from why i use "system" function in c, if i use other low level OS function, it could be faster such as Curl or something else.
It is never late to learn
|
|
|
|
|
|
Jusef Marzbany wrote: Pardon me Mr. toxcct!
When I found you're here online, I cought the time and a tought occured to me!
I have a (likely) simple problem and am trying to resolve it in this forum since 4 days ago; But nobody answered me!
Since I really need it, I decided to do so and ask you so ... Can you date a time to chat to me about that PLEASE?
I am at work.
I answer questions in this place in my free time.
I don't want to give my ID publically to anyone here.
If you have a question, ask it here, clearly, fully, and be patient.
If you don't get answers, it's because other people don't understand it, or they just don't know the answer, or you don't provide enough informations...
modified on Monday, September 15, 2008 7:24 AM
|
|
|
|
|
any way! thanks for your attention!
But I didn't mean to ask you republice your ID; I meant a private chat for once!
Thank you just the same ...
|
|
|
|
|
Hi There,
I want to extract images & banners with their redirecting URL from a website.
I'm using IHTMLElementCollection to enumerate the HTML elements but still not able to get the redirecting URL of images & banners.
If you need any further information/clarification please let me know.
Thanks!
|
|
|
|
|
Hello,
When I build the Release configuration of my MFC application I get the following linker warning:
LINK : warning LNK4089: all references to 'OLEAUT32.dll' discarded by /OPT:REF
How can I get rid of this linker warning? (without the use of /IGNORE:4089 )
Hiding the warning via /IGNORE:4089 in the project settings is not the solution I'm looking for.
My guess is that the problem comes from the 7.1 MFC libraries I use... is this true?
I'm compiling with Visual Studio 2003 (7.1)
Thanks in advance.
-- Ricky Marek (AKA: rbid)
-- "Things are only impossible until they are not" --- Jean-Luc Picard
My articles
|
|
|
|
|
#pragma comment(ignore: 4089)
|
|
|
|
|
Question: Can we use this #pragma comment(ignore 4089) for the warning related to "OLEAUT32.dll" only?
For what I understand, the use of the #pragma is the same as hiding the warning via /IGNORE:4089 in the project settings, which is not the solution I'm looking for.
Does anybody has another suggestion?
Thanks in advance
-- Ricky Marek (AKA: rbid)
-- "Things are only impossible until they are not" --- Jean-Luc Picard
My articles
|
|
|
|