I am using MFC CFile Seek function.
I have a problem about Seek out of file length.
CFile cfile;
BOOL bResult = cfile.Open(
L"C:\\2.TXT",
CFile::modeReadWrite |
CFile::modeCreate |
CFile::modeNoTruncate |
CFile::typeBinary |
CFile::shareDenyNone);
cfile.Seek(10000, CFile::End);
cfile.Close();
MSDN:
Remarks
The Seek function ...
What would be an easy way of implementing a console-based progress indicator for a task that's being executed, but I can't anticipate how much time it would take?
I used to do this back when I coded in Clipper, and it was only a matter of iterating through the chars '/', '-', '\', '|' and positioning them in the same place.
Any way / l...
I want to create a series of files under "log" directory which every file named based on execution time. And in each of these files, I want to store some log info for my program like the function prototype that acts,etc.
Usually I use the hard way of fopen("log/***","a") which is not for this purpose.And I just write a timestamp function...
I am implementing a log server in C++; that accepts log messages from a Java program (via log4j socket appender). How do I read these java logging objects in C++?
...
I need to find an element position in an std::vector to use it for referencing an element in another vector:
int find( const vector<type>& where, int searchParameter )
{
for( int i = 0; i < where.size(); i++ ) {
if( conditionMet( where[i], searchParameter ) ) {
return i;
}
}
return -1;
}
// caller:
c...
Hi,
I am using Listview,the View selected is largeicon mode. The problem i am facing is selection.using the arrow-keys i am able to navigate only in the first row(suppose i have 3 images in a row,if i press right arrow key,it will move till the end of row and again it will comeback to the first image of the same row)But the expected beh...
I have a base class:
class CBase {
public:
virtual void SomeChecks() {}
CBase() {
/* Do some checks */
SomeChecks();
/* Do some more checks */
}
};
and a derived class:
class CDerived : public CBase {
public:
virtual void SomeChecks() { /* Do some other checks */ }
CDeriv...
I wonder if and how writing "almighty" classes in c++ actually impacts performance.
If I have for example, a class Point, with only uint x; uint y; as data, and have defined virtually everything that math can do to a point as methods. Some of those methods might be huge. (copy-)constructors do nothing more than initializing the two data...
Hello, I'm refactoring legacy C++ system to SOA using gSoap. We have some performance issues (very big XMLs) so my lead asked me to take a look at protocol buffers. I did, and it looks very cool (We need C++ and Java support). However protocol buffers are solution just for serialization and now I need to send it to Java front-end. What s...
I have a program that needs to set the type of a vector as the program is executed (according to a value in a configuration file).
I have tried this:
int a = 1
if(a == 1) vector<int> test(6);
else vector<unsigned int> test(6);
test.push_back(3);
But this gives me:
Error 1 error C2065: 'test' : undeclared identifier
I'm not e...
#include "windows.h"
#include <string>
#include <iostream>
unsigned long crc32_table[] = {
0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419,
0x706AF48F, 0xE963A535, 0x9E6495A3, 0x0EDB8832, 0x79DCB8A4,
0xE0D5E91E, 0x97D2D988, 0x09B64C2B, 0x7EB17CBD, 0xE7B82D07,
0x90BF1D91, 0x1DB71064, 0x6AB020F2, 0xF3B9714...
I have native unmanaged code. I have created a managed C++ DLL and try to include this DLL into native unmanaged code. I got the following error
fatal error LNK1302: only support linking safe .netmodules; unable to link ijw/native .netmodule
How can I include managed C++/CLR DLL into native unmanaged code?
...
Hi friends,
I want to send the raw audio buffer to c++ for audio transcoding.
I have two option
using piped stream
using direct buffers (java.nio)
Are these really my 2 best options (and which would people recommend?) Thanks!
...
Hi all!!
We are developing C++ application for Windows, using Borland Code Gear 2007.
The main app has only one thread (this is a strong restriction). From this thread:
1) A Form is created (VCL from Borland).
2) Messages are received from both:
a. Messages from the window: messages including Windows mouse events, etc. (Form).
b. ...
i want to know which menuitem is clicked using WH_GETMESSAGE hook.can somebody help me please...from one week i stuck with this problem?
plz provide a way how can we achive this..using win32 dll. i am working on vc++6.0.
Thanks in advance....
...
I'm trying to create a magnifier app in .net using the Windows Magnification API. I've pretty much got everything working except for actually setting the magnification level (which defaults to 100%). The problem is, I can't find any examples anywhere on the net and all the documentation for the API is C++ code. This is the particular ...
Hello Stack Overflow. I am having a bit of a problem when handling a HDN_ENDTRACKW message for a custom class which derives from CListCtrl .
Essentially, it seem that when this message is sent, the actual value which stores the width of the column is not updated until after my handling code has been executed.
The code inside the handl...
I wrote a function along the lines of this:
void myFunc(myStruct *&out) {
out = new myStruct;
out->field1 = 1;
out->field2 = 2;
}
Now in a calling function, I might write something like this:
myStruct *data;
myFunc(data);
which will fill all the fields in data. If I omit the '&' in the declaration, this will not work. (...
This is a follow up to http://stackoverflow.com/questions/1417473/call-python-from-c
At the startup of the programm I call the following function to initialize the interpreter:
void initPython(){
PyEval_InitThreads();
Py_Initialize();
PyEval_ReleaseLock();
}
Every thread creates it's own data structure and acquires the lo...
How do I go about correctly playing audio files which may have a variable bitrate (and even a variable number of channels in some cases), such as ogg/vorbis?
XAudio expects this information in a WAVEFORMATEX structure on creation of the source voice, and doesn't seem to provide a means to change it for each buffer thats submitted...
...