Click to See Complete Forum and Search --> : Is it Possible to Access or Read a file from Different Machine
Revolution
November 25th, 2005, 12:40 AM
Dear Gurus,
I want to know that Is it possible to read the contents stored in a different Machine and it was connected to LAN.
If possible please give me some example.
Revolution
November 25th, 2005, 01:26 AM
Dear Guys,
Here is some more explanation. If I Access the file using IP Addr. It gives an Error Message (ERROR_LOGON_FAILURE).
Here is the sample code:
-------------------------------
FILE *fp = NULL;
fp = fopen ("\\\\192.192.192.192\\C\\FileName.txt");
if (fp == NULL)
printf ("Error No :%d:", GetLastError());
else
printf ("I can able to access the file");
-------------------------------
It gives the Error no :1326: Its an ERROR_LOGON_FAILURE.
Then how to open the file stored in that specify location.
HoM
November 28th, 2005, 04:53 AM
This sounds easy: If you get a Logon failure: logon!
(LogonUser( ...) with logon type logon32_logon_network should do it).
Or make sure, that guest accounts have access to that share ...
regards
HoM
hariCmenon
November 28th, 2005, 05:18 AM
Yes.That is the problem.
For example the logon cmd will be
LogonUser( Name, Domain, Passwd,
LOGON32_LOGON_INTERACTIVE,
LOGON32_PROVIDER_DEFAULT,
&LogonToken )
HoM
November 28th, 2005, 05:27 AM
Hi hariCmenon,
Why would you recommend a interactive logon (that comes with loading the profile and all that other overhead) ?
I really think, that a network logon should be enough, if you just want to copy a file to a share.
regards
HoM
hariCmenon
November 28th, 2005, 07:00 AM
I agree..with you. sir.
It has additional Cahing Mechanism and all.
I just Showed him an Example.
cheers.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.