|
Hi,
Does anyone know how to open files as read-only in VS2008 like you used to be able to do in VC++6.0? The number of times I have edited the wrong file, saved it and screwed up a totally different project
There is a drop-arrow on the Open button but it doesnt do anything.
Ta
|
|
|
|
|
Apply 'Read Only' property to all the files/folder you don't wanna to change.
|
|
|
|
|
Hi all,
I want to read a user input with spaces, say "Hello World". With scanf how can i do that. Because all the time after the space, I cannot read the input.
scanf("%[^\n]", name);
scanf("%s",&name);
fscanf(stdin, "%*s%99[^\n]", name);
None of the above solve my issue.
I appreciate your help all the time...
CodingLover
|
|
|
|
|
You can't do it with scanf - use gets[^] instead.
Edit before someone else says it: of course gets isn't safe to use since you can't specify the buffer size, so use fgets[^] instead.
modified on Wednesday, September 7, 2011 2:51 PM
|
|
|
|
|
Simply I tried the following, but it didn't work either
char test[1024];
printf("\nTest ");
gets(test);
I appreciate your help all the time...
CodingLover
|
|
|
|
|
scanf("%[^\n]", name); works.
If it does not, then check how name is declared.
It should be something like char name[1024];
|
|
|
|
|
I did exactly the same, but didn't work mate.
I appreciate your help all the time...
CodingLover
|
|
|
|
|
Run this and tell me what you get -
char name[1024];
scanf("%[^\n]", name);
printf("[%s]", name);
|
|
|
|
|
It simply print some garbage characters. Even in debug it'll not looking for the user input.
I appreciate your help all the time...
CodingLover
|
|
|
|
|
That's strange.
It works as expected for me.
Are you running it from a console application?
If you can give me more details like the environment that you're using and the type of program you're using, I could try to recreate the issue at my end.
|
|
|
|
|
Sorry for the late reply!
Yes it was a console application. I did this on VS 2008.
However when I use cin instead of scanf, works fine.
I appreciate your help all the time...
CodingLover
|
|
|
|
|
Same code worked fine for me am also using vs2008
|
|
|
|
|
How to set/remove ES_READONLY style of CEdit at runtime?
|
|
|
|
|
Have you tried ModifyStyle() , or SetReadOnly() ?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
To change it at runtime, you can't use the flag ES_READONLY directly. You have to use the EM_SETREADONLY message.
See MSDN.
|
|
|
|
|
Hi all,
I want to post a message to a specific server from windows 7 os.
Iam using WTSSendMessage api to post the message.
1. this api takes the handle to the opened server.
2. if i open the handle to my own machine and use that handle to the WTSSEndMessage api, i get the message in my machine.
3. Whereas if i open the handle to anyother machine and if i use the same handle in WTSSendMessage api, the function failing with error message, "Acess is denied.".
4. Also even the firewall is off in the machine where i try to send the message.
If anyone know the solution, pls let me know!
thanks,
Arun P.
Arun P.
|
|
|
|
|
On the MSDN site for WTSSendMessage[^] look for this text: "WTSSendMessage to a remote computer is denied by default " and read what it says. Could this be your problem?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> If it doesn't matter, it's antimatter.<
|
|
|
|
|
We have a print template that replaces generic keywords with specific information, and I've had some reports that the locale specific date format isn't 'taking' on some machines. We have:
if (Key == _T("#CDAT#"))
{
CTime time = CTime::GetCurrentTime();
Text = time.Format("%x");
}
This appears to work fine on all the machines I've tested it on, under XP, Vista and Win7. But we have a couple of users (one XP, one Win7) that report having to go to the control panel regional settings and 'flip' them, to get the right format in our app. And they report having to do this every time our app is restarted.
To be clear, these users have something like the following scenario:
1) They use the template and see the date come out in English (US) format (mm/dd/yy)
2) They go to regional settings and see that the locale is set to English (New Zealand), and thus the date should be in (dd/mm/yy) format.
3) They flip to English (US) and OK everything.
4) They go back to the settings and flip them back to English (New Zealand). This solves the problem until...
5) Our app is restarted, and steps 1-4 must be repeated.
I'm at a loss to even imagine how this behaviour could occur. There aren't any services or anything that try and 'fix' your locale settings are there? Anyone got any ideas?
Cheers
|
|
|
|
|
I'm leaning toward PEBCAK resolution here... just had a report that the problem 'went away' when my Win7 user changed his date format from dd/MM/yyyy to d/M/yyyy.
Hmmmmmmm.
|
|
|
|
|
sorry without specific solution. After reading your question, I 've got your mind and I think it is a "international" or "localization" problem.With different countries we have different languages and OS have different configuration. So if u want your program run consistently u should release your program with document that tell users what OS version and supported software they should have installed . Or u can do it with a solution that solve the problem above.
|
|
|
|
|
I've never had good luck with CTime::Format("%x") . Currently my date format is set to M/d/yyyy, yet Format() incorrectly returns the date as 09/07/11. If I change my date format to dd-MMM-yyyy, Format() reports the same as before.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
With a bit more research, I think CTime::Format("%x") uses the default system locale format, whereas I want the default user locale format.
I changed to using ::GetSystemTime() and ::GetDateFormat() , and I think that will work.
|
|
|
|
|
Hi
I have today a server using the "old" paradigm of one thread per connection. It works fine, but it does have problems when many simultaneous connections hits.
I'm looking at the IO completion, which to me look like the way I would like to go. Reducing the number of threads to ideally one per processor sounds promising.
But I have one problem I have not been able to find a solution for.
The server application is working as a pure request/response application, but a number of the requests will cause the server application to setup a connection to another server, send a request, receive a response, and then answer the original request with this information.
My problem is: How do I avoid blocking the worker thread (that received the original request) while I'm waiting for the connection to the next server to be completed. Is there a way to use IO completion while waiting for the connect() to finalize (without starting a new thread) ?
Thanks
Ole
|
|
|
|
|
In this setup you have to block the thread because the client does not know when the server is going to give it back a response unless you can create a connection back to the client.
Another thing I can think of is have the client connect directly to the second server.
|
|
|
|
|
I'm trying to set up a remote debugging. The application in question is a Windows service so that the program will be running on the system continuously.
The first thing I did was get off the package of "Ms Debbugging for Windows", and I managed to connect remotely using WinDbg. This leads me to having to install the program. My intention is to debug without any installation, according to research I see that there are other applications such as "Kd", "Ntsd", "Remote" that are lighter and require no installation.
Here goes my question, Is it possible in the side of the application to create the application server with any of these applications and light on the side where I hooked to that server debug using WinDbg?
Like I'm off track, is there some other correct settings to make this work?
We accept all kinds of ideas, suggestions, orders ...
Best rewards
kLvin
|
|
|
|