Click here to Skip to main content
15,888,527 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hey. Im trying to get Data from an config.ini that is on my Server. I try to use GetPrivateProfileIntA("httptester", "usagecheck", 0, [here i wanne add: https://example.de/config.ini]). Is it possible to get data from an .ini on an Server? Can you help me?

What I have tried:

I already tried:
char test[20] = "https://zer0ware.de/testing.ini"

and

if (GetPrivateProfileIntA("httptester", "usagecheck", 0, "https://zer0ware.de/testing.ini") != 0)
but i cant read this file...
Posted
Updated 17-Apr-20 8:21am
Comments
F-ES Sitecore 17-Apr-20 6:55am    
"It depends" on the server. Most web servers are configured to deny requests to config files. If you want to access an INI file over http you may need to configure the server to allow that, but bearing in mind the security implications.
Member 14804852 17-Apr-20 7:00am    
I have an Linux Debian 10 Server. But also I have an Webspace server and as u can see I just uploaded the ini to my Webspace so u can access from web: https://zer0ware.de/testing.ini
Can i use my server and just upload the file or did i need to make it with Sql and login, table etc.

It is possible, because it is a simple download of that file. Use URLDownloadToFile.

Take care for writing the file in a directory where you can write it. It is a common pitfull.

So watch out for the return code of that function.
 
Share this answer
 
Comments
Member 14804852 17-Apr-20 7:21am    
That is a great idea. I just download it to ".\\Users\\.\\AppData\\Roaming"
Can u help me with this?

I have discord or do u have another platform to write
It seems to me you are not "embedding the server" in your app. You are enabling access to a remote file with your application. Does this access have to be over the internet (or intranet) via http (or ftp) ? Or is the file on a network-accessible drive that you can access via the GetPrivateProfileInt call?

If the file is accessible via standard API calls like GetPrivateProfileInt or fopen or CreateFile then you just need a fully qualified name like \\ServerName\\drive... etc. or a mapped network drive and you can use API calls. If the access has to be via URL and internet protocols then KarstenK's suggestion is a good one.

It is not clear from your question because you have tried both approaches. If the file is accessible on an intranet it is possible the server does not support internet protocols so you would have to use the standard file APIs. That is really the fundamental question here : are you required to use internet protocols or not?
 
Share this answer
 
Comments
Member 14804852 17-Apr-20 15:26pm    
It's fully ur choice. What is better. I have an Linux V-Server with Debian 10 and an Webspaceserver with FTPaccess so you have to choose what should i do. I dont have any experience in API or connect to FTP. The easiest way would be over the http wait like: https://zer0ware.de/testing.ini. Can u help me? If u have any more questions or you can help me the easiest way is over https://discordapp.com/ and add WlanKabl.SaltyG#0666.
Rick York 17-Apr-20 23:26pm    
No, I do NOT have to choose. This is most definitely not my problem.

There are plenty of samples to help you with any API family you chose.

Member 14804852 18-Apr-20 7:00am    
I tried something: http://www.martinbroadhurst.com/downloading-a-web-page-in-c-using-wininet.html. But when i want to define the link it is an error... Idk what is the easiest way to get the ini and read it so i need help to choose. But i think i wont work with api because i have no experience.
Rick York 19-Apr-20 3:31am    
How can anyone help you when you have not defined your constraints? If this ini file is in use by the machine I will be surprised if it has an internet server running on it that will provide access to the file. Unless that is true you have to use one of the file access APIs but we don't know because you won't answer the question.
Member 14804852 19-Apr-20 19:41pm    
I got it...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900