|
15 GB text file?
Which file system you are using?
Величие не Бога может быть недооценена.
modified on Monday, November 2, 2009 3:34 AM
|
|
|
|
|
Hi, I'm using ReiserFS. Wikipedia says that the maximum file size is 8Tb. I guess splitting the file in chunks may be a good option. But anyway, what's the nature of the error?
|
|
|
|
|
Hi, the problem is solved. It was not an issue of how large the file was, but of an index in an array out of script. Thanks for your help!
|
|
|
|
|
Hi,
I tried to read in the some numbers in a file. I did following:
wifstream is(pFileName);
int int1 = 0, int2 = 0;
is >> int1 ;
is >> int2 ;
The "int1" and "int2" are always "0".
What is wrong?
Thanks
modified on Sunday, November 1, 2009 4:41 PM
|
|
|
|
|
What do you see when you open the file manually?
|
|
|
|
|
Hi
I can read in wide string. But I can not read numbers. I can get string by using "read" function. But I can not get anything back using operator ">>".
Thanks,
|
|
|
|
|
I suspect the numbers as you mention are stored as strings in your file.
If it is stored as numbers, it should not make any sense when you open the file manually.
|
|
|
|
|
Yes, I saved them as numbers not string. It tried to read a binary file which has string and numbers. The string was saved as string and numbers is as numbers (not string).
Why wifstream does not read number only string?
How can I correct them?
Thanks,
modified on Monday, November 2, 2009 11:56 AM
|
|
|
|
|
Hi again,
Can someone be helpful and show me a link or a piece of code that allows me to insert into my code so when the user clicks the X button at the top of the client so a message box appear and says "Are you sure you want to exit" along with the event.
Thanks
Andrew McIntyre
|
|
|
|
|
Handle the WM_CLOSE[^] message for the window.
You can put your message box in this handler.
|
|
|
|
|
switch (message)<br />
{<br />
case WM_CLOSE:<br />
MessageBox(NULL, "Are you sure you want to exit?", "Exit", MB_YESNO | MB_ICONEXCLAMATION);<br />
DestroyWindow(hwnd);<br />
break;<br />
}
Can someone help me find a missing identifier and show me where I have to put it.
Thanks
Andrew McIntyre
modified on Sunday, November 1, 2009 3:39 PM
|
|
|
|
|
case WM_CLOSE:
if (MB_YES == MessageBox(hwnd, _T("Are you sure you want to exit?"), _T("Confirmation"), MB_YESNO))
DestroyWindow(hwnd);
return 0;
For MFC it could look like this -
void CYourClass::OnClose()
{
if (MB_YES == MessageBox(hwnd, _T("Are you sure you want to exit?"), _T("Confirmation"), MB_YESNO))
DestroyWindow(hwnd);
}
|
|
|
|
|
 Hi. I think I've done something wrong somewhere.
#include <windows.h><br />
<br />
#define WINDOW_WIDTH 1040<br />
#define WINDOW_HEIGHT 750<br />
<br />
const char lpClassName[] = "My Project";<br />
HWND mainWindow;<br />
<br />
LRESULT CALLBACK WindowEvent(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);<br />
<br />
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)<br />
{<br />
WNDCLASSEX wc;<br />
wc.style = CS_VREDRAW | CS_HREDRAW;<br />
wc.lpszMenuName = NULL;<br />
wc.lpszClassName = lpClassName;<br />
wc.lpfnWndProc = WindowEvent;<br />
wc.hInstance = hInstance;<br />
wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION);<br />
wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);<br />
wc.hCursor = LoadCursor(NULL, IDC_ARROW);<br />
wc.hbrBackground = (HBRUSH) GetStockObject(BLACK_BRUSH);<br />
wc.cbWndExtra = 0;<br />
wc.cbSize = sizeof(wc);<br />
wc.cbClsExtra = 0;<br />
<br />
RegisterClassEx(&wc);<br />
<br />
mainWindow = CreateWindowEx(<br />
NULL,<br />
lpClassName,<br />
"My Project",<br />
WS_OVERLAPPEDWINDOW | WS_VISIBLE,<br />
(GetSystemMetrics(SM_CXSCREEN) / 2) - (WINDOW_WIDTH / 2),<br />
(GetSystemMetrics(SM_CYSCREEN) / 2) - (WINDOW_HEIGHT / 2),<br />
WINDOW_WIDTH,<br />
WINDOW_HEIGHT,<br />
NULL,<br />
NULL,<br />
hInstance,<br />
NULL<br />
);<br />
<br />
if (!mainWindow)<br />
return 0;<br />
<br />
UpdateWindow(mainWindow);<br />
<br />
MSG msg;<br />
<br />
while (1)<br />
{<br />
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))<br />
{<br />
if (msg.message == WM_QUIT)<br />
TranslateMessage(&msg);<br />
DispatchMessage(&msg);<br />
}<br />
}<br />
return (int) msg.wParam;<br />
}<br />
LRESULT CALLBACK WindowEvent(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)<br />
{<br />
switch (message)<br />
{<br />
case WM_CLOSE:<br />
if (MB_YES == MessageBox(hwnd, _T("Are you sure you want to exit?"), _T("Confirmation"), MB_YESNO))<br />
DestroyWindow(hwnd);<br />
<br />
return 0;<br />
break;<br />
}<br />
return DefWindowProc(hWnd, message, wParam, lParam);<br />
}
Andrew McIntyre
|
|
|
|
|
You really must do this on your own.
Change the first parameter of MessageBox from hwnd to hWnd .
|
|
|
|
|
I got three compile errors:
'MB_YES' : undeclared identifier
'_T': identifier not found
'_T': identifier not found
Andrew McIntyre
|
|
|
|
|
Can someone help me with those errors.
Please
Andrew McIntyre
|
|
|
|
|
MessageBox Function()[^]
Look under the return value section for what you're looking for.
_T("") is a text macro, you can try TEXT("") if it's not defined. If both are undefined, just don't use it. (put function("text here") instead of function(_T("text here")))
|
|
|
|
|
MrMcIntyre wrote: if (MB_YES == MessageBox(hwnd, _T("Are you sure you want to exit?"), _T("Confirmation"), MB_YESNO))
DestroyWindow(hwnd);
hwnd has not been declared.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
Hi. I fixed the other 2 errors just one last error to fix.
if (MB_YES == MessageBox(hWnd, ("Are you sure you want to exit?"), ("Confirmation"), MB_YESNO))<br />
DestroyWindow(hWnd); <br />
else <br />
return 0;
The error was:
'MB_YES' : undeclared identifier
Andrew McIntyre
|
|
|
|
|
Read the docs for MessageBox(), specifically the return value
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
Can you create a quick snippet of how the code should look like.
Andrew McIntyre
modified on Monday, November 2, 2009 5:17 PM
|
|
|
|
|
MrMcIntyre wrote: That is the right code...
Andrew, if it was right the compiler would not be complaining.
MrMcIntyre wrote: ...its just the undeclared identifer I need fixed.
What is it that you think MessageBox() needs to return?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
Where can I find the documentation from?
Andrew McIntyre
|
|
|
|
|
Its ok. I fixed it. You guy's are the best. Thanks
Andrew McIntyre
|
|
|
|
|
Other than the link I provided, I'm not sure.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|