|
are you sure your dataPtr is not NULL ?
(or 0 - whichever your prefer )
|
|
|
|
|
lol
I just checked that and it seems my data pointer is not pointing to the right place. LOL. fix that and then try again.
Thanks. I might be back.
|
|
|
|
|
ok pointers are all correct now, data is where I need it to be. But still, no data being written when calling the fwrite.
|
|
|
|
|
Did the file open succeed? If you look at the data buffer in the debugger is it what you expect? What does errno tell you? Why aren't you checking what fopen() and fwrite() return.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Firstly, your code should be like this:
fwrite(dataPtr, sizeof(unsigned char), datalength, filePtr);
It does not make any difference in case of a char, but if you use integers for example, your code will try to write 4x4xdatalength = 16xdatalength bytes of data, instead of writing 4xdatalength bytes.
Anyway, apart from that be sure to check the datalength. Check out whether it is 0 or not.
If it still does not work, add the following line after writing to the file:
fflush (filePtr);
Mustafa Demirhan
http://www.macroangel.com
Sonork ID 100.9935:zoltrix
<nobr>They say I'm lazy but it takes all my time
|
|
|
|
|
Ok,
I did finally find it. Turned out that my global datasize number was being clobbered all the time, aka ending in a data size of 0 to be written.
Thanks for all of your help! I REALLY appreciate it!
Woo HOO!!
Dan
|
|
|
|
|
Dear Forum,
Ok, this is really starting to bug me. Anybody have any idea why the 'TableName' is not being added to the string 'str', even though the 'TableName' seems to be valid as the watch window shows the correct value and the TRACE call does manage to successfully out put it?
for (std::vector<DFields *>::iterator it = pConfig->Samples.begin(); it != pConfig->Samples.end(); ++it)
{
CString str = _T("");
if (pConfig->IncludeComputer)
{
str += (*it)->ComputerName;
str += _T(" : ");
}
if (pConfig->IncludeTable)
{
TRACE("*%s*\n", (*it)->TableName);
str += (*it)->TableName;
str += _T(" : ");
}
str += (*it)->SampleName;
m_ListSelected.AddString(str);
}
After this function, 'str' is (sans quotes): "Barn 1 Feed : : Total Daily Feed"
and the TRACE output is: "*743 Daily*".
str should be: "Barn 1 Feed : 743 Daily : Total Daily Feed"
I have tried to do a rebuild all, exit dev studio and then rebuild all, even rebooted my computer. But still no luck. All I know is that I will probably see what I am doing wrong as soon as I hit the submit button
[edit]
ComputerName, Tablename, and SampleName are all CStrings.
[/edit]
Signed
Confused in abby
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
I don't have a clue,
but have you tried casting the TableName to f.e. (char *) or something alike..?
I wouldn't be amazed if it was some sort of type-confusion..
|
|
|
|
|
hmmm. That worked. wierd
Thanks a lot .
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
Its because your mixing crappy old MFC CString and lovely new STL, you naughty boy you.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Hello i was told to look here for something that would convert a VC++ 7.10 Project to a VC++ 7.0 project can anyone help me ???
|
|
|
|
|
|
Hi,
I'll try to explain my problem in as few words as possible so I won't scare anyone off with long posts
Mission :
I'm working on a hobby-project to render graphics that change with user-input.
Problem :
GfxObjects can be deleted/changed, but *during* rendering that's a big NONO as you'll probably understand
Possible solutions :
- Multithreading.
Tried it, it's a very big pain in the arse.
GfxObjects could be plugins with their own imported edit-dialogs and I don't want other developers to have the burden of doing locking / unlocking everywhere (and give'em a perfect opportunity to crash my app).
- Singlethreaded :
OnIdle is fine, it's just not enough.
F.e. when the mouse enters the menu, idling stops.
Same for window-resizing etc.
The ideal way would be :
{
ProcessUserInput( [for a maximum time of 1/100th sec.] );
RenderFrame();
}
I hope some of you guys have suggestions on how to tackle this
-
Lennart Denninger / GameCoder / Guerilla Games
|
|
|
|
|
Well like it or not I think you need to use the multithreading approach to get the result you want. One interuptable thread for rendering, and UI back in the main app thread.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
I know...
But it would be nice to have a way to lock the object-system before all the ui-handling and unlock it afterwards.
Just like locking it before rendering and unlocking it after rendering.
Locking / unlocking for every single change sucks,
it means that for someone to write a plugin with an edit-dialog the code would look like this :
CEditDlg::OnVar1Changed()
{
LockObjectSystem();
// change var here
mObject->SetVar("General.SplineSegments", 10);
UnlockObjectSystem();
}
I'd prefer something like
{
LockObjectSystem();
UpdateALLDialogsAndSettings();
UnlockObjectSystem();
}
'cause in this case the people creating plugins wouldn't need to know about all the locking-stuff, and more important - they wouldn't be able to send my app down in flames by simply forgetting to lock/unlock.
|
|
|
|
|
Why can't you collect the info they enter in the plugin and then apply it when the plugin finishes. This puts you in total control and you can handle any locking required.
Can't say I comprehend precisely what you are getting at with locking, but I assume you only want one user/thread/plugin to be able to change objects at a time.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
A message-based system like you propose has crossed my mind (and I even started implementing it),
but it seems like an overly complex solution to a very simple problem
Then I'd have create a message-system that handles a lot of different (custom) messages,
lock/unlock a message-queue etc....
If only there was a way to
1st) update the UI and thus the gfx-object parameter changes
2nd) render the frame
where the rendering would be virtually uninterrupted, and the UI would be allowed to have some lag...
The plugins don't "finish" by the way;
it's a normal app with an edit-window for the configuration of the selected effect (selected from a listcontrol in another window).
So the render-thread is rendering non-stop,
and meanwhile the user can change effect-properties in the UI.
(Think of a winamp-plugin with a realtime edit-window)
Still, right now I'm thinking of going back to the multithreaded system..
But then I still want to find a way to make sure the plugins can't crash the app.
Which means taking the locking/unlocking out of their hands - but I still have to find an elegant way to do that :-/
|
|
|
|
|
Forgot to mention this :
The (plugin)edit-dialog also has to display the current values for all the effect-parameters.
Which would mean for a message-based system like you proposed (gathering all entered data and processign it later),
that the message-system has to be bidirectional.
(Since you're not only inputting new values, but also *reading* them from the object)
And that's a whole different, (imho way *too*) complex ballgame.
Ps.
I don't want to disrespect you or anything,
(I really value your input on my problem !!)
but your signature looks really
"Hey! look at me! I'm a professional developer!"
flashy kind of thing
Isn't it a bit too much..?
|
|
|
|
|
Is it feasible to have two instances of the "object system". One is used by the renderer and the other by the UI components. Whenever the renderer has finished etc. it asks the UI object if it has changed, and if so it copies whatever it has to, to get in sync. A lock would only be necessary during this sync process.
re. my signature, you should have seen it a year or so back. I'm open to suggestions to tone it down further?
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Neville Franks wrote:
I'm open to suggestions to tone it down further?
I don't have a problem with it at all
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Ryan Binns wrote:
I don't have a problem with it at all
Thanks, I thought it was reasonably tame.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Hi, all:
I have an odd problem that I have been experiencing. I create a simple Dialog-base application and then add two buttons to it. Each button click calls creates a MODELESS dialog. I have a big OK button on each dialog and the OK button overlaps some. If I set both modeless dialog style in Resource Editor to Popup, everything works fine. If I change the style to Child, then the problems come in. Click on Button 1 to create Dialog Num1. Click on OK button on Dialog Num1 , the button on the main dialog gets the click, seems like the MODELESS dialog is behind the main dialog, even though visually it is on top. Also, Click on button 1 to create Dialog Num 1 and then click on Button 2 to create Dialog Num 2. If I don't move the dialogs, when I click on the OK button on Dialog Num 2, the message for button clicking goes to Dialog Num1 which is create first and underneath of Dialog Num2. It seems that Dialog Num 1 is on top of the Dialog Num 2, even though visually otherwise. Another issue is when those dialog get moved, the redraw does not work correcly. I tried use SetWindowpos with WndTop or WndTopMost, it does not affect the result. I try to use MoveWindow, SetFocus, same thing.
Is this a MFC bug, or simply the MODELESS dialog can not have Child style.
Any help or suggestion is highly apprecaited. thanks in advance.
Dion
|
|
|
|
|
DionChen wrote:
Is this a MFC bug, or simply the MODELESS dialog can not have Child style.
A modeless dialog can have a child style. It is kind of hard to follow your explanation but I can say that I have experienced some problems with modeless dialogs. However, you should use the pop-up style which is used for dialog boxes. Since you don't have any problems with the pop-up style then why do you worry so much?
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
Is there a good quality SDK out there that someone could recommend to enable me to print PDF files from within my C++ application? Adobe doesn't provide me a way to set printer tray information (pass in a DEVMODE structure) and they frequently popup dialogs. I've found a ton of PDF SDK's out there, but none of them have a good set of printing functions. I need the ability to specify a printer and tray and know that no message boxes are going to pop; since this will run as an engine application. Thanks, Ron.
|
|
|
|
|
I'm working with dialog boxes for the first time in .net, and I can successfully show a dialog box from a starting dialog, but the second one always has additional Ok and Cancel buttons pasted into the upper right corner and the phrase "TODO: Place controls here." None of these things appear in the form editor. Anyone know how to get rid of them?
|
|
|
|