|
Hi everyone
I have some problem with fread and fwrite in VS2005 beta2
I have the following code, in it i generate a buffer and after assigning some values to it , i write it to a file , then i try to read it back to a new buffer which is not successful.
for variable bigVal=100 i get "k=100" for writing but for reading i get "k=77" , i would be pleased if someone can help me.
#include "stdafx.h"
#include <stdlib.h>
#include <time.h>
#include <stdio.h>
typedef double dtype;
int _tmain(int argc, _TCHAR* argv[])
{
dtype *b;
int i,j,k;
int bigVal;
char filename[]="c:\\temp.data";
FILE *fp;
bigVal=100;
b=(dtype*) malloc(bigVal * sizeof(dtype));
for(i=0 ; i
|
|
|
|
|
Hello.
I'm not sure if it's your only problem, but you should definately use binary mode for your files. So use:
fopen(filename,"wb")
and
fopen(filename,"rb")
Kakan
|
|
|
|
|
in fread and fwrite the first parameter is "void *" so try typecasting the first parameter as following
fread((void*)b,sizeof(dtype),bigVal,fp);
fwrite((void*)b,sizeof(dtype),bigVal,fp);
it worked when i tried past.
FAILURE is the first step towards SUCCESS
|
|
|
|
|
Hi
The CListCtrl click handler shows an edit box that allows to edit the subitem values. That is working fine when I click using the mouse.
But now, I need to simulate a click in a ClistCtrl, to open that edit box automatically.
I already tried using mouse_event but the mouse pointer appears in the task bar, and nothing else happens.
So, I think, I should call the CListCtrl click handler.
OnClick(NMHDR* pNMHDR, LRESULT* pResult)
The NMHDR* really is a NMITEMACTIVATE pointer.
So I filled the ptAction, iItem, and iSubitem and created a LRESULT variable.
Then I call OnClick((NMHDR*)struct, &lResult);
The handler is called, but the edit doesn't appear, and when I close the application it hangs up, and tell me if want to tell it to Bill Gates
Any suggestion really appreciated, and thanks for reading all that
Sebastian
|
|
|
|
|
You could send a direct message to the list ctrl, like:
m_List.SendMessage(WM_LBUTTONDOWN,0,MAKELPARAM(2,20));<br />
Sleep(100);<br />
m_List.SendMessage(WM_LBUTTONUP,0,MAKELPARAM(2,20));
However, the mouse-location (2,20) must be correct for it to work properly. Most probably you want an item to be selected also, which means that you have to calculate the item's correct location in the list ctrl.
An alternative would be to select an item in the list ctrl through code, and take its text and show the edit box yourself, without depending on the click-handler.
this is this.
|
|
|
|
|
you remember you helped me with the same code. i'm using this still. its cool!
"But your mind is very complex, very tricky. It makes simple things complicated. -- that's its work. And for centuries it has been trained for only one thing: to make things so complicated that your life becomes impossible."- Osho
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[V]--
|
|
|
|
|
I think I'm gonna doit the hard way, because I can't simulate the click.
The code you gave me doesn't work, altought it should.
To get the coordinates, I used a MessageBox in the click handler to show me the point, and I used those values, but Nothing :S
Thanks for the help man
|
|
|
|
|
Is IE Plugins ( like Acrobat Plugin for IE
or Flash Plugin/ Media Player etc) are ActiveX Controls or ActiveX documents;?
Is there any link for more information?
Happy New Year
|
|
|
|
|
IE Plugins are ActiveX Object.
I dont know anything called ActiveX documents.
-Prakash
|
|
|
|
|
Hi
You can get the links on google.
One thing i know is that you have to implemet the IHtmlDocument interface for it
Cheers
Ganesh
hi
|
|
|
|
|
ActiveX Documents are a little-used technology that appeared in the mid '90s to allow embedding other document types within an application. For example, when you click a link in IE that loads an excel or word document, Excel or Word runs inside the IE application.
onwards and upwards...
|
|
|
|
|
basementman wrote: ActiveX Documents are a little-used technology that appeared in the mid '90s to allow embedding other document types within an application. For example, when you click a link in IE that loads an excel or word document, Excel or Word runs inside the IE application.
Thank you.
-Prakash
|
|
|
|
|
The Plugins are kind of viewer, which can load any special document and display it.
The behave is little different from other Active X Controls.
I am looking for any reference sample.
|
|
|
|
|
When using an application through automation you may not wish for error messages to appear, this being because if an error occurs your application would hang waiting for you to deal with the dialog box prompted by that error. This seems to be something to do with the modality of error messages. Is there something i can set prior to say calling CWinApp::OpenDocumentFile(filename); so that an errors generated by this call do not stop the application from continuing. I'm ok if the error message means that the application crashes or fails or whatever, i just want to provide that option to the user so that they can deal with the error themselves...does that make sense and is that possible (i'm thinking its gotta be!)
Thanks
Will
|
|
|
|
|
Is the dialog box that you are talking about is related to ASSERT dialog box?
If yes, build in Release version, In release version you wont see the ASSERT dialog box.
-Prakash
|
|
|
|
|
no its not, so that doesnt solve the problem
|
|
|
|
|
Can you type out the message that you see in the dialog box?
btw, it is not worth ignoring any error.
may be we can identify the problem and solve it permanently.
-Prakash
|
|
|
|
|
I dont wish to ignore the error, i just dont want a dialog box telling me there is an error, this is to be used under automation, i just wish to have the option. The error displayed is
"an unknown error occured while accessing C:\myfile"
But i created this error myself, the file is corrupt and is meant to be, i just dont want the dialog box telling me
Will
|
|
|
|
|
I have written COM objects, but I never pop messages from the COM Object. The com object should always return an error using the HRESULT return value. The client should deside wheahter to show the dialog or not or take appropriate action against the error.
You say that you are poping the error, so it is doing what it is intending to do.
may be you need to change the design a little bit but a correct design solves the problem.
Hope I helped you.
-Prakash
|
|
|
|
|
I am developing a win32 based application which acts as interface between two applications. The Interface application has to act as a service application. Is there any option to make the interface application as an service or develop the entire application as windows service application. Can you help me by giving your suggestions.
chandu
|
|
|
|
|
the easiest way is to create a new VisualStudio project using 'ATL COM AppWizard', and then select 'Service' as server type. Wizard will create everything for you.
if you want to do it manually, you will have to adapt your application to conform to the rules of
SCM[^].
more details here: Services[^]
|
|
|
|
|
|
Where can I get the winfax.h & winfax.lib files for sending the FAX using the FAX API.
aasstt
|
|
|
|
|
|
HI Friends,
Will anyone please tell me how i can use my C++ modules/Interfaces in .Net.
I want to use them in C#.
Thanks,
Sumit
Sumit
|
|
|
|