|
If access to your file was limited to a certain user, then you could run your program as that user. I've not done this before so it may or may not work for your situation.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hello
I have problems with a few "things" and "circumstances" and so need help.
Prologue:
many years ago i learned to create progs in C, later on I tried a bit of "C++",
but i never left my pc-environment. Now, i had to send data to a server - that's
very exciting for me - especially cause i don't know the basic "terms" and "procedures".
Perhaps someone can explain me the following problems:
Problem:
1. Get data out of my existing programm and create a xml-file.
2. Include additional files in this xml-file (like jpg's) and code it in base64-manner.
3. Send this file to a server
4. Get an answer from this server ...
5. ...and work with it further more in my prog.
The items 1, 2 and (soon, i hope)5 are solved, but i can't understand the mechanism of
"talking" to a server out of my c-programm???? I never had to do this in the past,
i'd always opend lokal files or databases via ODBC or other lokal things. When i had to send
files to a server, i used a ftp-software on my desktop, but I have never done this from my code...
I've got a documentation from the server-admin, which tells me the following:
1. create a xml-file, insert all the stuff which is needed and then "...name it xmlpackage..."
what is this? - no extension (perhaps xml) for a file? for me, it seems "unusual" but this
isn't the "real problem" - this looks like a "wrong behaviour" to me...
2. then, use the following address to send the data:
https://www.theservername.com/XML/interface.php?postTheNewData
what does this mean? Is this the adress i had to send my file to?
but: is it right, that the expression after the questionmark is a parameter? so why is it
called "postTheNewData" and not "xmlpackage" like a few lines above?
3. i used the function WpPost of the mfc to try sendng files, and the wizard asked me a lot
of things and at the end - an error occured....(and my file isn't send)
4. and this is only the sending -part - what shall i do for retrieving new data?
Additional Question:
Is it possible to send and retrieve data with the mfc and without using third-party-programms?
How can i get a response after sending - if the sending is ok or not?
Perhaps, someone can help me out of this situation, because after i asked the admin in the
past, the only answer i've got from him, is: "...in every programming - language must be
a function to post data to a server, but i can't help you now - good luck..."
So please, be patient with me. I dont know someone to ask for, so i contact this group because i
will code the answer in "c/c++".
Thanks a lot for an quick answer.
|
|
|
|
|
fish4fun wrote: 2. then, use the following address to send the data:
https://www.theservername.com/XML/interface.php?postTheNewData
what does this mean?
HTTPS is Secure Sockets over HTTP
http://en.wikipedia.org/wiki/HTTP[^]
http://en.wikipedia.org/wiki/Https[^]
fish4fun wrote: Is this the adress i had to send my file to?
It appears so.
fish4fun wrote: Is it possible to send and retrieve data with the mfc and without using third-party-programms?
Yes it is. There are several ways, one might be to use the WinInet classes like CInternetSession[^]
fish4fun wrote: How can i get a response after sending - if the sending is ok or not?
It depends. Learn HTTP then ask more questions.
fish4fun wrote: Perhaps, someone can help me out of this situation, because after i asked the admin in the
past, the only answer i've got from him, is:
After you get more knowledge of HTTP and HTTPS perhaps you can ask more specific questions of the admin and he will be able to supply the answers you need.
led mike
|
|
|
|
|
Wow....downvoted for that? Brutal
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Sorry, if i used the wrong button!
That was a very good answer, because it was quick and an answer!
|
|
|
|
|
In addition to led mike and CPkid's replies...
For working with XML:
XML Processing Options[^]
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I should probably change my CP name to downvoted
led mike
|
|
|
|
|
May as well - that's what I call you :P
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
See if this link helps.
It should answer some of your questions related to HTTP.
Even I am new to all this and I also went through this code in the morning and it was indeed very helpful to me.
Hv a nice day.
the fruits of your success will be in direct ratio to the honesty and sincerity of your own efforts in keeping your own records, doing your own thinking and, reaching your own conclusions.
..surviving in autumn..in love with spring..
|
|
|
|
|
When I add a new button and want to add a even of the button by double clicking it.
But it appear the error message as below:
Add/Remove operation is impossible, becuase the code element CDialogCommon is read only
How do I solve it?
|
|
|
|
|
I get this sometimes.
All I do is close the solution and open it again.
Then it seems to work.
If not check if the files are actually read only.
« Superman »
|
|
|
|
|
I am calling a function in a thread that contains an infinite while loop and I want to stop that loop and as well as kill/exit thread on some condition.
Can anyone please tell me how to do that?
Regards,
Mushq
|
|
|
|
|
TerminateThread will do the job, if you're not concerned about cleanup/releasing of resources.
BOOL WINAPI TerminateThread(
__inout HANDLE hThread,
__in DWORD dwExitCode
);
|
|
|
|
|
Bad advice. See here[^] for details (the documentation also warns against using it).
Steve
|
|
|
|
|
I think its second times that somebody told about use of TerminateThread and you reply to him or her why its bad with a link.
|
|
|
|
|
Yeah, That sounds about right. It's one of those classic mistakes that even "professional" programmers make over and over again.
Steve
|
|
|
|
|
I personality like to read your replys because they arecomplete and helpful.
|
|
|
|
|
|
Use some kind of signalling mechanism between the thing that detects the termination condition and the thread. That infinite loop should have a check at the top for the condition. Easiest choice in windows is to use an event. Only use TerminateThread as an absolute last resort, only if you can't do it some other way. I've been multithreading for over 20 years and I have never had to use TerminateThread. It leaves your system in a mess, with all sorts of resources still allocated.
Judy
|
|
|
|
|
JudyL_FL wrote: I've been multithreading for over 20 years
Come on, Judy...since you were a toddler? I'm not buying it
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
My very first job out of college had multithreading in it. Granted it was 8085 assembler inside a cash register instead of C on a windows PC but still ....
|
|
|
|
|
|
Hello everyone,
I am quite new in programming.
Through windows, a data file can be related to a default program to be open with.
I would like to know how to get the path and name of this "double-clicked" data file in my c++ console aplication (a quick example would be to write a code which returns the complete path of a file when this is double-clicked if we set our program to be the default "opens with" for the file).
Thank you in advance and kind Regards,
Marcos
|
|
|
|
|
FindExecutable
Retrieves the name of and handle to the executable (.exe) file associated with the specified file name.
Syntax
HINSTANCE FindExecutable(
LPCTSTR lpFile,
LPCTSTR lpDirectory,
LPTSTR lpResult
);
|
|
|
|
|
I am not sure but I think this is not exactly what I want.
What I need is the name and the path of the data file (not the executable one) to work with it in my program
|
|
|
|