|
If you'd get to work a little earlier and start answering questions, we wouldn't have these problems!
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hi all!
I have a project where I have to write documentation for source code.
As I have no experience in writing documentation, I wanted to ask you guys- does any of you have any experience with that, and what recommendations could you give? Eventually links to good articles about that?
Thank you!
Iliya Yordanov,
www.csharp-home.com
|
|
|
|
|
what is it for ? use or maintenance ?
first of all, you code must be commented (it doesn't mean to comment each line of code. it just means to do it smartly).
then, describe the function with what they do (and not necessarily how they work to obtain such result - this is in the code comments).
cheers,
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
There are many types of documentation. But for technical usage doc, then I recommend DOxygen[^]. Its free and a good automated way of documenting your work.
I Dream of Absolute Zero
|
|
|
|
|
Check out this[^] article
Artificial intelligence is no match for natural
stupidity.
Never argue with an idiot. They will drag you down to their level where they are an expert.
|
|
|
|
|
Hi
I am trying to understand what file is in Win32 system and how to access.
Let me be more specific. I am comming from the UNIX word where a file is an area in the disk in a location pointed out by a "unique" integer number known as the inode. Each process then traditionaly has an array of 15 file handles and any time a file is opened is is associated with one entry on the that array. The array number is the file handle and numbers from 0 to 2 are the standard ones. For higher lever IO there is the standard FILE structure which is associated with one of the FILE handles.
In windows you have the HANLDES that are returned by CreateFile, the CFILE classes and on top of that the Unix compatibility functions like _open() to open the whatever UNIX style handles.
I am trying to make sense of those (whithout the complexity of named pipes, memory ereas etc) as I think I make sense the UNIX/C interface. I am looking for a document to explain
i. How an area in a disk is related with file structures
ii. What is the meaning representation of compatibility functions in Win32? E.g. for my own inverstigation I found that the _stat (aka stat of UNIX) returns always the same inode number whatever the file is.
iii. How can I related the different handles logically. I saw hadles document which explains how to convert from one to the other but how they are related?
iv. How the files, the HANLDE and processes are related.
Any help will be much appreciated.
Life is a river with mist ahead...
|
|
|
|
|
Dimitris Vikeloudas wrote:
E.g. for my own inverstigation I found that the _stat (aka stat of UNIX) returns always the same inode number whatever the file is.
Which is what the documentation says it will do on FAT, HPFS, or NTFS file systems. It is a UNIX-specific value.
Dimitris Vikeloudas wrote:
iii. How can I related the different handles logically.
What exactly do you mean by this? A handle is nothing more than an object identifier. You have a handle: Dimitris Vikeloudas. It is what's used when we want to communicate with you (except that we do not destroy yours when we are done!).
Dimitris Vikeloudas wrote:
iv. How the files, the HANLDE and processes are related.
There is no relationship, except that a process can "own" zero or more handles. Per MSDN, a process is a running application that consists of a private virtual address space, code, data, and other operating-system resources, such as files, pipes, and synchronization objects that are visible to the process. A process also contains one or more threads that run in the context of the process. A handle is a a variable that contains the address of another variable, which in turn contains the address of the desired object, or a token that an application can use to identify and access an object such as a device, a file, a window, or a dialog box.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hi.
Thanks very much. Your definition of the process it is enlightening.
So for a file you have a HANLDE pointing to a handle structure pointing to a file structure related to disk. That's what I am getting.
Is any similar chain for the CFile object? Also what happen with the UNIX compatibility functions like open. Is the integer that they return a handle casted to int or a is there an array of file descriptors that the C runtime environment maintains to emulate the UNIX process structure?
And what about stdio FILE structures? How do they know the access tokens of the files that they correspond. Simply what I am trying to understand is what is the relationship between an area in a disk and the logical structures. I think you answered what a HANDLE does on that.
If you know any documentation going to all these details will be much appreciated.
life is a river with mist ahead..
|
|
|
|
|
|
Dimitris Vikeloudas wrote:
Simply what I am trying to understand is what is the relationship between an area in a disk and the logical structures.
I do not believe windows gives the user access to any of the kernel structures it uses to read/write files. At most you get a handle tell the kernel what hidden (to the application) structure to use to access the file. CFile, stdio, and streams all use the Windows api CreateFile, ReadFile, WriteFile and CloseHandle to open/create, read, write and close files.
John
|
|
|
|
|
Dimitris Vikeloudas wrote:
i. How an area in a disk is related with file structures
No relation at all.
John
|
|
|
|
|
There are 2 main structures in Windows system: FAT32 & NTFS.
The NTFS system is similar to the UNIX ,But the FAT32 are not. you can search the topic about FAT32 from MSDN or Google.
|
|
|
|
|
i'm doing a project but now i'm struck...
i was given an image(256 by 256)i need to differentiate the selected area region.. this is how the project goes...
on the image i nedd to draw a bigger Circle(A)and a smaller circle(B) inside (A), both the circle pixel value are set to 1..
outside the (A) the pixel is set to 0...
between (A) and (B) the pixel is set to 2...
inside (B) the pixel value is set to 0....
anyone who can help pls reply...
/*this is for the bigger circle*/
int r, c;
int i,n,n_1;
bool hit;
for(r=0; r<n_rows; r++){
="" for(c="0;c<n_cols;c++){
" index[r][c]="2;
" }
}
=""
for(i="0;" i<area_pix_cnt;="" i++){
="" r="(area_pix[i]/255)-1;
" c="(area_pix[i]-(r*n_cols))-1;
" r<n_rows;="" r++){="" left="" to="" right
="" hit="true;
" while="" (hit)="" {=""
="" if(index[r][c]="=1){
" }
="" else="" {
="" c++;
="" if="" (c="=n_cols)" }
}
for(r="n_rows;">0; r--){ //Right to Left
c = n_cols;
hit = true;
while (hit) {
if(index[r][c]==1){
hit=false;
}
else {
index[r][c] = 0;
}
c--;
if (c==0) hit=false;
}
}
for(c=n_cols; c>0; c--){ //Top to Bottom
r = n_rows;
hit = true;
while (hit) {
if(index[r][c]==1){
hit=false;
}
else {
index[r][c] = 0;
}
r--;
if (r==0) hit=false;
}
}
for(c=0; c>n_cols; c++){ //Bottom to Top
r = 0;
hit = true;
while (hit) {
if(index[r][c]==1){
hit=false;
}
else {
index[r][c] = 0;
}
r++;
if (r==n_rows) hit=false;
}
}
area_pix_cnt=0;
for(r=0; r<n_rows; r++){
="" for(c="0;" c<n_cols;="" c++){
="" if(index[r][c]="=1" ||="" index[r][c]="=2){
" n="((r)*256)+" (c+1);
="" area_pix[area_pix_cnt]="n;
" image256[n]="255;
" area_pix_cnt++;
="" }
="" }
}
="" *this="" is="" for="" the="" smaller="" circle*=""
for(r="0;" r<n_rows;="" index_inner[r][c]="2;
" }
}
=""
for(i="0;" i<area_pix_cnt;="" i++){
="" r="(area_pix[i]/255)-1;
" c="(area_pix[i]-(r*n_cols))-1;
" r++){="" left="" to="" right
="" hit="true;
" while="" (hit)="" {=""
="" if(index_inner[r][c]="=1){
" else="" {
="" c++;
="" if="" (c="=n_cols)" }
}
for(r="n_rows;">0; r--){ //Right to Left
c = n_cols;
hit = true;
while (hit) {
if(index_inner[r][c]==1){
hit=false;
}
else {
index_inner[r][c] = 0;
}
c--;
if (c==0) hit=false;
}
}
for(c=n_cols; c>0; c--){ //Top to Bottom
r = n_rows;
hit = true;
while (hit) {
if(index_inner[r][c]==1){
hit=false;
}
else {
index_inner[r][c] = 0;
}
r--;
if (r==0) hit=false;
}
}
for(c=0; c>n_cols; c++){ // Bottom to Top
r = 0;
hit = true;
while (hit) {
if(index_inner[r][c]==1){
hit=false;
}
else {
index_inner[r][c] = 0;
}
r++;
if (r==n_rows) hit=false;
}
}
/*combine together*/
area_pix_cnt=0;
for(r=0; r
|
|
|
|
|
<list> First: use some formatting (<pre> tags work great)
Second: Replace all your < and > with '<' and '>'
Third: Smells like homework
Fourth: Please narrow your problem down. We have no clue what problems you want to solve with our help
Improve your post at those points and ask again.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
you sum up so good so many anonymous posts...
when i see plain code like this, i don't even bother reading any code line...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
toxcct wrote:
you sum up so good so many anonymous posts...
Thanks! I feel flattered .
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Bob Stanneveld wrote:
I feel flattered
you are...
in the other hand, i don't have enough word to criticise those "spamers"...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
toxcct wrote:
in the other hand, i don't have enough word to criticise those "spamers"...
I don't think that we should criticise them for a few reasons:
<list> I don't want to waste too much time on them
If they get all the critics, they might do it for fun (try and post a programming question in the lounge and see how many angry reactions you get )
It's bad for your health if you worry too much about it
...
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
How Dare you?, How can you use you hand for Writing
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
I didn't do it, but my fingers itch when I think about it ...
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Bob Stanneveld wrote:
It's bad for your health if you worry too much about it
thank you so muck Ô sir Yoda...
i'll think about it, really
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
I created an SDI application. When i click on one of the menu items a dialog box pops-up. I want the values of a few variables that are declared as public in the View class to be accessed and modified in the dialog box. I tried creating an object of the view class in the dialog class, but doesnt work.How do i do it? Please Help.
|
|
|
|
|
Use
CMyView* myView = (CMyView*)AfxGetMainWnd()->GetActiveView();
to get a pointer to the view.
Rahim Rattani
Software Engineer,
Matrix Systems (Pvt) Ltd.,
Karachi - Pakistan
|
|
|
|
|
nripun wrote:
I tried creating an object of the view class in the dialog class
Errr, I think this is not a good solution
What you need to do is, when creating your dialog, send the variables to the dialog (using a public member function) before calling DoModal. Exemple:
CYourDialog::CDialog
{
public:
void SetVariable(int Value) { m_ViewVar = Value; }
private:
int m_ViewVar;
}
Then when creating your dialog you can do that:
CYourDialog Dlg;
Dlg.SetVariable(Variable);
Dlg.DoModal();
So nowm inside your dialog class know the value of the variable from your View. If you need to retrieve it, the same, add a member function to retrieve the value.
Why using functions and not public variable ? In fact this is a good habit to have: your member variables should be private (or protected in case of inheritance) and they can be accessed through Get/Set methods...
Hope this helps
|
|
|
|
|