PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV Mobile 22 → simple question about fopen() function
simple question about fopen() function
Débuté par VEGEboss, 01 juin 2018 17:05 - 7 réponses
Membre enregistré
20 messages
Posté le 01 juin 2018 - 17:05
In a (very simple) wireless network (with a Windows 10 PC as Server)
there is a shared folder "C:\share Android"

This folder is well visible using any "file-manager-app"

is possibile to create a file using this syntax?

nPnt = fOpen("\\192.168.1.3\share Android\" + DateSys() + ".dat", foCreateIfNotExist)


...because it gives me an error "No such file or directory" and the reported Path has
ONLY ONE backslash "\" at the beginning

thanks for your help
Membre enregistré
131 messages
Posté le 01 juin 2018 - 18:20
Hi VEGEboss

I never tried something like that but just thinking it make sense
Yes it is a share file but the device can't access because you need to "log in" to that PC, because of that it can't be access
The only way I know to do such a thing it's using the function NetworkConnect() but this is only available on Windev only not Windev Mobile.

Maybe using FTP functions, you maybe could create a file, you can access to the file and then download some files or images if that it's what you want.

I hope my knowledge could help...

Best Regards
Jose
Message modifié, 01 juin 2018 - 18:21
Membre enregistré
20 messages
Posté le 01 juin 2018 - 18:37
Hello Jose

my idea is really similar to your reply… how can I read/write a file if I'm not logged in the network?
(I'm exploring this solution just to have another path to follow, different from FTP)

I also tried to "map" the shared folder using "ES File Explorer" but I don't konw how to build the full path
because a simple approach like this

nPnt = fOpen("/SURFACE/share_Android/" + DateSys() + ".dat", foCreateIfNotExist)


still don't work…. (maybe the / at the beginning?)
Message modifié, 01 juin 2018 - 18:38
Membre enregistré
131 messages
Posté le 01 juin 2018 - 19:12
Hi VEGEboss

Well the full path it's the IP and the rest of the files to get to it but like I said you need to log in and then access
That's the only way possible to access or create a file that's why you "share" the file to some "users" or "all users" then the device it's a user
that needs to be log in.

Sorry I can't help a lot that's all I know.

About the path it's not wrong at all:

fOpen("\\192.168.1.3\share Android\" + DateSys() + ".dat", foCreateIfNotExist)


because you clear it said that "This PC" on "this path of files get me those .dat" because if you use this sentences with the user to log in to that PC it will bet those files right away if that user have the rights to access and then rights to read and write obviously.

but well like I said like it or not you need to log in yes or yes, the bad part it's that on Mobile doesn't have that type of function right now, I really hope some day we will have one.

This is all I know by fellow developer I wish I can help but this is all I know maybe some other could help you more than me I hope so...



If you get the solution PLEASE! let me know it will help me a lot because Now that I remember... I have a project that I need to access to a pc and get access to some files and images without using FTP and I don't know how to do it...


Best regards
Jose
Message modifié, 01 juin 2018 - 19:16
Membre enregistré
20 messages
Posté le 01 juin 2018 - 20:09
Hello Jose

I have some interesting news

I found the TRUE path…

nPnt = fOpen("smb://tablet:@NEWLIFE/share_Android/" + DateSys() + ".dat", foCreateIfNotExist)


("tablet" is the name of the Windows user dedicated to this operation)

and the good news is that the fOpen( ... ) function DON'T gives an error!!!
and the same all the following fWriteLine( ... ) !!!
and the fClose( ... ) TOO!!



...but :( ;( }:(

in the folder on the PC… NOTHING HAPPENS



I REALLY don't understand...
Membre enregistré
131 messages
Posté le 01 juin 2018 - 21:53
Hello VEGEboss

I see but maybe it's that you can see and know the files but if you have no rights at all to access maybe that's why nothings happens
Are you on a local network or something with that device?

Best regards
Jose
Membre enregistré
77 messages
Posté le 04 juin 2018 - 17:13
Hi. As I see that you have discovered, to access from Linux/Android to the Windows file archive you must use Samba (SMB://...), try some of the libraries available to make that kind of connections. Please note that even though the Windows file system is shared, other operating systems do not know what to do or how to handle it. Perhaps one possible option is to use sockets on the mobile device to connect to the desktop computer and send the files to it.

Rubén
Membre enregistré
20 messages
Posté le 04 juin 2018 - 17:36
Thanks Ruben for your reply

My idea (my hope… :( ) was to OPEN a file and to write into, not to simply copy it to the PC

I have NO EXPERIENCE about Samba but I want to do some tests

Maybe the better way is passing through a HF Database...
Message modifié, 04 juin 2018 - 17:36