|
iLoveM wrote: FILE *f = fopen(read,"rb");
u try opening the file in write mode.
if that too failes, u can conclude one of the following
1. A file already exist in that path and is been opened by another process
2. Path is invalid
3. Don't have privilage
and let me know the results
nave
|
|
|
|
|
iLoveM wrote: FILE *f = fopen(read,"rb");
If fopen() fails, what is the value of errno ?
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
iLoveM wrote: Why?
You should be telling us why. If you are opening the file via CreateFile() and it's failing, what does GetLastError() return?
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
It's too strange!!!
STARTUPINFO si;
ZeroMemory(&si, sizeof(si));
si.cb = sizeof STARTUPINFO;
CHAR szFolderWhereFileIsLocated[250]={0};
strcpy(szFolderWhereFileIsLocated ,"put path here");
PROCESS_INFORMATION pi;
CreateProcess("A.exe",
NULL,
NULL,
NULL,
FALSE,
0,
NULL,
szFolderWhereFileIsLocated,
&si,
π);
when i put these code in a console program, the sub process can open correctly. Then in my windows program, the sub process can't open file firstly, then start up the sub process again (my program will start up the sub process every 20 sec) , it's OK.
Just relax
|
|
|
|
|
hi all ,
i am facing a problem while displaying 2 byte japanese characters in web page.
actually what i m doing is reading the japanese string as a string and then writting it to xml file and then use the xml file to fill the web page .
so what i m getting is single byte characters corresponding to the the japanese chracters.
If anyone has any answer then please reply
Surendra Vishwkarma
Surendra Vishwkarma
|
|
|
|
|
|
Actually the constraint is that we should not mention any encoding in the XML file
Surendra Vishwkarma
|
|
|
|
|
He is referring to the header of the XML which generally indicates that the XML is encoded using UTF-8. When writing the XML, you probably need to convert the native UNICODE string to UTF-8.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
so how will we convert unicode to utf-8 ,could u please send me a small code snippet
Surendra Vishwkarma
|
|
|
|
|
|
Anyone know the reason why the WS_MAXIMIZE style bit isn't taking effect when I don't also specify the WS_POPUP for the window's style? MSDN doesn't suggest it's ignored, although a quick Google leads me to believe it could be for overlapped windows.
I need to initially maximize a window during the app startup. I've always used ShowWindow() in the past when maximizing a window without much headache, but now I need to control the order in which this happens moreso to avoid unsightly drawing issues as I need to perform quite a few tasks during the startup (working on my first 3D game). As such, I'd rather have it maximized before the window is shown rather than after and don't want to go through the trouble of screwing around with the message queue to deal with it.
Surely there must be a simple way for an overlapped window?
TIA
Jeremy Falcon
|
|
|
|
|
SetWindowPlacement()
Kuphryn
|
|
|
|
|
That doesn't work either (just tested, it's still ignored), unless I use it after the window has been shown, which means I still get the flickering during startup.
[edit] Ok, I made a couple changes with the queue and got it to maximize, but I still get the drawing issues that I do with ShowWindow(). Now, pardon me while I beat my head against the wall. [/edit]
Thanks for the reply though.
Jeremy Falcon
|
|
|
|
|
I got rid of the flicker by adding a couple of painting ops (hope it doesn't mess me up down the read as I'm new to OGL).
But, if anyone knows why CreateWindow() doesn't honor WS_MAXMIMIZE for anything but a popup, you'd be my new hero for the day. Either way, thanks for watching me whine.
Jeremy Falcon
|
|
|
|
|
How is ShowWindow() called? In most applications, ShowWindow() is called *after* you've called CreateWindow(), hence making your window seemingly ignore your flags. In MFC apps, what's passed to the mainwindow's ShowWindow(), is whatever the process has been fed (settings on shortcut, spawning process, etc).
Jeremy Falcon wrote: As such, I'd rather have it maximized before the window is shown rather than after and don't want to go through the trouble of screwing around with the message queue to deal with it.
You don't need to fiddle with WS_MAXIMIZE. Just create the window without the WS_VISIBLE flag. Then call ShowWindow() with SW_SHOWMAXIMIZED. No screwing around with the message queue.
--
100% natural. No superstitious additives.
|
|
|
|
|
Jörgen Sigvardsson wrote: ShowWindow() is called *after* you've called CreateWindow()
It has to be, otherwise I wouldn't have a valid handle.
Jörgen Sigvardsson wrote: Just create the window without the WS_VISIBLE flag.
Did that. In fact I rarely use that bit for a main window.
Jörgen Sigvardsson wrote: Then call ShowWindow() with SW_SHOWMAXIMIZED.
Did that, except I used SW_MAXIMIZE instead.
Jörgen Sigvardsson wrote: No screwing around with the message queue.
Not always. At first, doing what you just described, it was showing the window, then showed it maximized, and then drawing the OGL scene. There's a small delay during startup because of the processing involved, but it was a three part startup that I could actually watch happen.
So, I thought, why just use the bit in CreatWindow() itself except that didn't work. Hence my post.
Anyway, I got around it by messing with my drawing code, but I would still like to know why in tarnation that style bit didn't work for CreateWindow.
Jeremy Falcon
|
|
|
|
|
Oh, and thanks for the reply. It's the end of the day and I'm getting slow.
Jeremy Falcon
|
|
|
|
|
|
aafcls wrote: am I missing something
If you are missing knowing how C++ .h and .cpp files and class/function declarations and definitions work then yes, you are missing something.
|
|
|
|
|
it may be best for you to read some books and go through some tutorials instead of getting a quick answer to your problem - this is really fundamental so you should learn the basics before going on with your task
cje
|
|
|
|
|
aafcls wrote: am I missing something in this file, like a declaration or header?
Yes. You need to declare class members when creating the class. I would suggest you search around for a few tutorials on the web to help get you up to speed on this.
If you perfer books, then there are quite a few excellent MFC books out there I can recommend as well.
Jeremy Falcon
|
|
|
|
|
Can you show how to declare this function
whitesky
|
|
|
|
|
I have an application where I want to be able to receive data from a socket at any time and at the same time be able to send data. Is it ligitimate to issue a send()in the main thread while I am blocked on a recv() on the same connection in a different thread?
BCS
|
|
|
|
|
Are you doing asynchronous or synchronous I/O?
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I am doing synchronous I/O.
|
|
|
|