|
Would I be able to limit the file that prog creates then write a line that states if you reach x size then create another file and contine?
|
|
|
|
|
I don't see why not.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I am new to all of this. Could you point me in the right direction?
|
|
|
|
|
What method are you currently employing to create the file?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
ofstream outClientFile ("diction.txt", ios::out);
|
|
|
|
|
Ok, so what methods of the ofstream class are you using to write to the file? How are you verifying that the file has maxed out at 4GB? Perhaps you could put together a small program, similar to what Rick did except use ofstream , that exhibits the problem.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
According to the MSDN website, the max size for a file on FAT32 is 4GB and under NTFS it is 16TB. I just tried a little experiment here and was able to write a file of 5GB on a system using NTFS. I used fopen to create the file and fprintf to write to it. FWIW, it took 163.2 seconds to write the file with some diagnostics output occuring. I would attempt bigger files but I didn't want to spend the time.
|
|
|
|
|
Rick York wrote:
FWIW, it took 163.2 seconds to write the file...
Nothing wrong with that. I wonder how long it would take the SetFilePointer() /SetEndOfFile() pair to do something similar.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
The book I'm using does not have those commands in it. Would you be kind enough to send me a sample code using those two commands?
|
|
|
|
|
Here's my testing program :
int main( int argc, char* argv[] )
{
FILE *fp = fopen( "C:\\Temp\\BigFile.txt", "wt" );
if( ! fp )
{
fprintf( stderr, "Unable to open temporary file\n" );
return -1;
}
int megcount = 0;
if( argc > 1 )
megcount = atoi( argv[1] );
if( megcount < 100 )
megcount = 100;
const __int64 onemeg = 1000000;
__int64 max = megcount * onemeg;
fprintf( stdout, "Beginning file writing of %d MB\n", megcount );
const int writeincr = 20000000;
int wcount = 0;
CElapsed et;
double start = et.Elapsed( 0.0 );
__int64 total = 0;
__int64 lines = 0;
const char *format =
"0123456789012345678901234567890123456789012345678901234567890123456789012345678901234 line %8I64d\n";
while( total < max )
{
int count = fprintf( fp, format, lines );
total += (__int64)count;
wcount += count;
if( wcount >= writeincr )
{
wcount = 0;
int meg = (int)( total / onemeg );
double amount = et.Elapsed( start );
fprintf( stdout, "%4d megabytes have been written : %.1f seconds elapsed\r",
meg, amount );
}
++lines;
}
double elapsed = et.Elapsed( start );
fclose( fp );
fprintf( stdout, "\n\noutput file has been closed - %I64d lines were written in %.1f seconds\n",
lines, elapsed );
return 0;
}
The CElapsed class is one I wrote and contributed to codeguru years ago. It's use can be removed from the code if you want. It's only used in the diagnostic output.
This is just a hacked-together testing program that took about five minutes to write. It's not exactly an example of excellent code.
|
|
|
|
|
How would I be able to use fprintf to write this to a file?
for (int a=0; a<10; a++)
{
for (int aa=0; aa<10; aa++)
fprintf(outClientFile,a,aa)endl;
}
|
|
|
|
|
In case you want it - here's the CElapsed timer. I use it for high-resolution timing. It typically has a an overhead of around 2uS, depending on CPU, so it can usually time to within 10uS.
#ifndef _CELAPSED_H
#define _CELAPSED_H
#else
#error repeated include of this file
#endif
class CElapsed
{
private :
double m_Period;
int m_Initialized;
__int64 m_Frequency;
public :
CElapsed()
{
m_Initialized = QueryPerformanceFrequency( (LARGE_INTEGER *)&m_Frequency );
if( ! m_Initialized )
m_Period = 0.0;
else
m_Period = 1.0 / (double)m_Frequency;
}
double Elapsed( double begin=0.0 )
{
__int64 endtime;
QueryPerformanceCounter( (LARGE_INTEGER *)&endtime );
double endsecs = endtime * m_Period;
return endsecs - begin;
}
BOOL Initialized()
{ return m_Initialized; }
__int64 GetFreq()
{ return m_Frequency; }
double FromMilliSecs( UINT millisecs )
{ return 0.001 * millisecs; }
void Delay( double amount )
{
double delta;
double delaytime;
double start = Elapsed( 0.0 );
while( true )
{
delaytime = Elapsed( start );
delta = amount - delaytime;
if( delta <= 0.0 )
break;
if( delta > 0.0012 )
Sleep( 1 );
}
}
};
|
|
|
|
|
Hi,
I have created a Comboboxex and it doesn't send message for WM_MOUSEMVOE. So i can't add a tooptip control above it. I tried but it still doesn't work. Here is my code for creating Comboboxex:
hWndFontCombo = CreateWindowEx (
0, // extended styles
"ComboBoxEx32", // extended combo box – will
str, // default text
WS_VISIBLE | WS_CHILD | WS_TABSTOP |
WS_VSCROLL | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | CCS_NORESIZE |
CBS_AUTOHSCROLL | CBS_DROPDOWN,
rect.right,0, // x, y
MIN_COMBOCX-8, // width
2* cy * NUM_FONT_TYPE, // height
hWndParent, // parent window
(HMENU)ID_COMBO, // ID
hInst, // current instance
NULL ); // no class data
Can anyone tell me how I can display the tooltip for this comboboxex? Thanks a lot.
|
|
|
|
|
Why are you creating the control at runtime rather than at design time? In any case, has EnableToolTips() been called? Are you handling the TTN_NEEDTEXTA and TTN_NEEDTEXTW notifications?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
How to call EnableToolTips for Win32 based code (not MFC code). Thanks.
|
|
|
|
|
I think you might need to call InitCommonControlsEx() instead. To create the tooltip window, use CreateWindowEx() with TOOLTIPS_CLASS as the second parameter. See here for more.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I'm trying to read whatever is stored in my document inside the Serialize method
But, whenever I read into a string from the archive, it takes out that string from the archive. Thus, when I call the Baseclass serialize, the outputted Document is missing the string that was read. Is there a way to read such that the string is not taken out from the archive? I tried reading the string after I called the base class serialize, but I get only an empty string.
Thanks, (code is below).
void CRichedDoc::Serialize(CArchive& ar)
{
CString buf;
ar.ReadString(buf);
CRichEditDoc::m_bRTF = FALSE;
CRichEditDoc::Serialize(ar);
}
|
|
|
|
|
vasanth1004 wrote:
void CRichedDoc::Serialize(CArchive& ar)
{
CString buf;
ar.ReadString(buf);
CRichEditDoc::m_bRTF = FALSE;
CRichEditDoc::Serialize(ar);
}
Shouldn't this be:
void CRichedDoc::Serialize(CArchive& ar)
{
if (ar.IsStoring())
ar << m_buf;
else
ar >> m_buf;
} I've not ever used CRichEditDoc or m_bRTF so I may be way off.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
What I had originally works, but it removes the string from the archive. I also tried creating a new archive by getting the filename from the passed archive, but it didn't make a difference.
Thanks
|
|
|
|
|
vasanth1004 wrote:
What I had originally works...
So what did you do that made it stop working?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
DavidCrow wrote:
So what did you do that made it stop working?
Sorry, I was wrong. It didn't work the way I wanted to: it reads it but also removes the string from the Archive.
Basically I just want to read the contents of the current document into a String without removing what I read from the Archive. How do I do that?
|
|
|
|
|
Put them into two separate variables and than concatenate them.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
|
Yes.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hi,
i have a question regarding OpenGL and double buffering.
The drawing routine has the following commands:
wglMakeCurrent(m_hDC, m_hRC);
DrawScene();
SwapBuffers(m_hDC);
wglMakeCurrent(0, 0);
The problem is that SwapBuffer seems to clear the screen before actually copying the backbuffer in. This seems quite strange to me. The content to draw consists of approx. 50000 single points drawn using the GL_POINTS directive. It seems that the problem only occurs with a high number of points (or it is only visible there). Can anyone give me hints what could be wrong?
Of course double buffering is enabled in the Pixelformat:
...
pfd.dwFlags = PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER;
...
Thanks in advance,
Ingo
|
|
|
|