|
Often times, when disk-io needs to be sped-up there are gains to be made in the way that the data is accessed -but not so much (if any gain) available in the function used to get that data.
For example - if you have (say)a million pieces of data stored in a file, it's a better(faster) option to use ReadFile just once and read in the 1,000,000 pieces of data than it is to call the function 1,000,000 times to read 1 piece of data.
Provided you're running in an OS with protected memory (i.e not DOS), no - not practically. You could attempt to write some low level code, but I'd suspect that the folk that wrote that part of windows would be more capable of speed than you.
Are you able to elaborate on the conditions in which you're using ReadFile, and the reasons you've come to the conclusion it's slow? It's very likely that algorithmic improvements can be made.
|
|
|
|
|
How do you measure "slow"? At the very best a ReadFile() operation will operate at the transfer speed of the disk and its interface. At the very worst there are lots of factors that may affect it.
The best things in life are not things.
|
|
|
|
|
Disk I/O in itself is slow, regardless of the API used. What exactly are you needing to do?
"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
|
|
|
|
|
I read data from a drive at different locations. I can not read large data because of some memory issue.
Why it's slow because i check one software which reads it fast.
|
|
|
|
|
Usually when reading from a file, then one reads in small chunks like one byte at a time.
If using a wrapper around ReadFile like fstream, then it will perform readahead caching by reading large chunks from the file into memory. When reading small chunks from fstream, then it will actually read directly from the internal cache inside fstream.
|
|
|
|
|
Hi all,
i want to send info to my server and on server side server processed on received information and get back some result on my side i receive the result and display a message what is returned by server.
so please tell me how can i do this processing?
what function or methods are use for this.
please help me for this and provide info and guidance for this.
thanks in advance.
|
|
|
|
|
There are many ways to do this (TCP/IP for instance), and most of them can be found with a simple Google search. CodeProject also has many articles on the subject.
"Real men drive manual transmission" - Rajesh.
|
|
|
|
|
Hi!
It depends on how you want to send the info to your server(whether it's in XML format or some other format). If it's XML use IXMLHTTPRequestPtr::open() to connect with the server and IXMLHTTPRequestPtr::send() to send ur XML content to the server. IXMLHTTPRequestPtr::responseText; to get the response from server.
Some body has already posted the whole code for this at the XML/XSL forum. See the reply of pix_programmer.Link below:
http://www.codeproject.com/Messages/427887/Failed-to-CreateInstance-while-using-IXMLHttpReque.aspx[^]
|
|
|
|
|
can i use POST method for this operation and function?
|
|
|
|
|
Le@rner wrote: can i use POST method for this operation and function?
I didn't fully understand your question. You can call open() function with "POST" as first parameter and the url or IP address of ur server as second parameter. Please go through the link I've given. It contains code that can be used as such if you are working with a VC++/MFC or a Win32 project.
|
|
|
|
|
I would almost venture to say raw sockets over your own API is the best method for a learner... everything else, including HTML/XML/Web Services is based on the socket foundation. So understanding sockets can be a great foundation.
|
|
|
|
|
Either use MFC wrapper classes or Windows API (try sockets, unless you want to write a totally custom driver). Use the Linux API sets for programs that you want to run on Linux. Alternatively you could use a third party networking solution (library), but I recommend coding a front end networking class that will load up different definition files based on the values of a set of macros (ex. #define OS WINDOWS). If your object oriented skills are up to par, then it should be no problem to write it once and port it to future programs, occasionally modifying the definitions based on the API updates/changes for each respective operating system you want to support.
|
|
|
|
|
I compiled a MFC application in debug mode.
When I run the program, most time, it was OK, but in a few times, it occurred following error:
Debug Error!
Program:
......XXX.exe
R6010
-abort() has been called
(Press Retry to debug the application)
Last night, I left the program running, it also occurred such error.
Now I let the program run for two hours,but the error has not occurred yet.
It seems the error occurred randomly, how can I get rid of the annoying problem .
|
|
|
|
|
You could take the advice given in the message at the bottom: "Press Retry to debug ...", and use your debugger to find out how it arrived at that call.
The best things in life are not things.
|
|
|
|
|
This is an error probably from CRT... like Richard already mentioned, if you debug, you should be able to see both why the abort() was called and what part of your code triggered it (look through call stack).
|
|
|
|
|
Q: What's the best way to eat an elephant?
A: One bite at a time.
Have you tried narrowing down the problem to something a bit more manageable? In other words, if you've got a 1000-line program and something is wrong, rather than look at each line with equal suspicion, remove (irrelevant) lines until the problem goes away. Or, start over and add lines until problem appears. This way you can focus your effort on a much smaller problem.
"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
|
|
|
|
|
Hello everyone!
I have a CDialog derived class named CCalibrationDialog. As the name shows I want that dialog to control a procedure of a calibration (non-relevant: camera shutter/gain calibration). I would love to be able to show the progress of this procedure with a CProgressCtrl object but I have a little (maybe dumb) problem. I follow every step of this tutorial (http://www.codersource.net/mfc/mfc-tutorials/cprogressctrl.aspx[^]) which seems to show the easiest way to control the progress bar but my program asserts as if the CProgressCtrl is not initialized.
Here's a code snippet:
#pragma once
#include "afxcmn.h"
class CCalibrationDialog : public CDialog
{
DECLARE_DYNAMIC(CCalibrationDialog)
public:
CCalibrationDialog(CWnd* pParent = NULL);
virtual ~CCalibrationDialog();
enum { IDD = IDD_DIALOG_CALIBRATION };
CProgressCtrl m_ProgressCtrl;
.
.
.
protected:
virtual void DoDataExchange(CDataExchange* pDX);
virtual BOOL OnInitDialog();
DECLARE_MESSAGE_MAP()
public:
afx_msg void OnBnClickedButtonCalPrg();
};
void CCalibrationDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_PROGRESS_CAL, m_ProgressCtrl);
}
BOOL CCalibrationDialog::OnInitDialog()
{
m_ProgressCtrl.SetRange(0,100);
m_ProgressCtrl.SetStep(10);
return true;
}
.
.
.
void CCalibrationDialog::OnBnClickedButtonCalPrg()
{
m_ProgressCtrl.StepIt();
}
Any ideas?
Thanks a lot for any feedback!
Ody Z.
|
|
|
|
|
Asserts where?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
_AFXCMN_INLINE void CProgressCtrl::SetRange(short nLower, short nUpper)
{ ASSERT(::IsWindow(m_hWnd)); ::SendMessage(m_hWnd, PBM_SETRANGE, 0, MAKELPARAM(nLower, nUpper)); }
Thanks for the response! Do you have any idea what may be wrong?
|
|
|
|
|
What you showed should be fine. I'm guessing at your call to progressctrl.SetRange() the progress control's HWND is 0/NULL, yes? If so, it sounds like the progress control with a matching ID isn't being found on the dialog form.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I'm sorry but I didn't quite understood what you said... I agree that apparently the HWND of the m_ProgressCtrl is NULL, but isn't that supposed to be fixed by DoDataExchange() ?
Which, by the way, is never executed, at least a breakpoint at the line: DDX_Control(pDX, IDC_PROGRESS_CAL, m_ProgressCtrl); is never accessed when I debug...
Cheers!
|
|
|
|
|
Odysseas Z wrote: Which, by the way, is never executed
It's been a while and I forget, but maybe you need to call the base class OnInitDialog() from your OnInitDIalog override?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Why the solution always has to be so obvious? It worked!
Thanks a lot!
Best Regards!!!
Ody Z.
|
|
|
|
|
Odysseas Z wrote: Why the solution always has to be so obvious?
If it wasn't so obvious we would have seen it right away!
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Since I needed a way to stop / disable COM port DTR signal I have ventured into unknown territory of multithreading . I am making progress.
Now I need to use same approach to start / stop audio recording.
I am using waveInOpen function with CALLBACK_FUNTION.
Upon receiving the WIM_DATA the callback function will run the worker thread.
However,waveInOpen has an option to use CALLBACK_THREAD and I am unable to find any examples on how it can be used.
Since using callback can be challenging, it is for me, I like the callback function giving me feedback aka – WIM_OPEN.
How can I get that response from CALLBACK_THREAD / worker thread?
I am coding in VC++ / MFC, please do not waste your and mine time suggesting alternative development tools.
Any constructive help will be as always appreciated..
Cheers
Vaclav
|
|
|
|