|
I already shown in my code how i opened to read file with "rb"
|
|
|
|
|
just a guess. wouldn't flushing the stream help you in this regard ?
|
|
|
|
|
toxcct, you may be onto something here.
I've done this:
for(unsigned int i = 1; i <= dict_size; i++)<br />
{<br />
dictionary[i] = readintbigendian(in);<br />
if(i%60==30)
fflush(in);<br />
}
Interestingly, it now starts reading incorrectly from the 30th value onwards. So flushing is the cause of it rather than the solution. I'm no expert on the internals of stream mechanics, so any suggestions on how to restructure my stream access would be highly appreciated.
|
|
|
|
|
hum, but are you sure you want to write this ?
for(unsigned int i = 1; i <= dict_size; i++)
instead of this :
for(unsigned int i = 0; i < dict_size; i++)
because arrays are 0-based.
but i'm not sure this is related though
|
|
|
|
|
No it isn't. The reason it starts at 1 is cos I store the length of the dictioary array in the first element.
|
|
|
|
|
arg, but that's awful !!! lol.
really, you should consider revising this bad habit
for the flushing stuff, i have no much idea unfortunately
|
|
|
|
|
well it's not a habit lol. I just did it that way cos it's quick and easy. It's a varsity project so I'm not too bothered about it being elegant. :p
|
|
|
|
|
flushing is to commit the data to disk which the OS keeps in memory for optimisation, "The commit-to-disk feature of the run-time library lets you ensure that critical data is written directly to disk rather than to the operating-system buffers", this may not be the issue in your case.
if you want to use call flush after the write loop to ensure data is written directly to disk.
|
|
|
|
|
That is the same habit that Pascal strings (and BSTR s) have.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
|
hi masters,
i want to allocate memory (64k) at the desired location (address). i remember that it is possible.
can any one give me some idea regarding this?
thanks in advance.
|
|
|
|
|
before giving you more directions, i'd like to know your goals please.
why are you needing to allocate such a huge amount of memory at a given location which windows will probably overwrite or already handles some...?
|
|
|
|
|
toxcct wrote: huge amount of memory
64K? Seriously?
|
|
|
|
|
Hi
thanks for your response.
here is the task please guide me.
i want to interact with an ISA device in the system, and to access its registers, it demands to access the memory available at some X location.
this we came to understand by studying an obsolete console application written for that device.
any ideas?
thank you.
|
|
|
|
|
On NT4 and higher, you cannot directly access the devices registers. The OS will not permit it. You need to have a driver and your app then interacts with the driver.
Judy
|
|
|
|
|
the OS that iam using is windows 98. so it should support right?
|
|
|
|
|
Yes it should but I don't remember how to specifiy the memory mapping.
Judy
|
|
|
|
|
toxcct wrote: why are you needing to allocate such a huge amount of memory
hehe
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
Hello I'm new in MFC and all this small and ease tasks in c# seems to me very impossible in MFC.
I'm trying to do a log file.
I need to take the current system time and date and then transformed it in CString in order to write them in the file.
Tnx for the help,
And have a nice weekend.
|
|
|
|
|
Use CString::Format (or sprintf in the example below)
see this[^] for an example.
|
|
|
|
|
mihai123 wrote: all this small and ease tasks in c# seems to me very impossible in MFC.
You mean MFC is hard? You must write an ActiveX control in plain Win32, my friend
SYSTEMTIME time;
GetSystemTime(&time);
CString str;
str.Format("Year: %d, Month:%d, Day of month:%d,
Day of week:%d",time.wYear, time.wMonth, time.wDay, time.wDayOfWeek);
AfxMessageBox(str);
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Rajesh R Subramanian wrote: You mean MFC is hard? You must write an ActiveX control in plain Win32, my friend
Never used MFC for that. ATL was far much better .
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
CPallini wrote: ATL was far much better
No, the point was that the OP said doing things with MFC is hard. So, I thought how nice it must be for the OP to write an ActiveX control with Win32, not even MFC.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Hi..
I have specified string
sample.jpg
I want only extension as output
output = .jpg
plz help me
manju
Hi..
I am Mnaju.I have Completed my B.E Computers Science.Lokking for a job.I am interested in VC++
manju
|
|
|
|