|
Hamed Mosavi wrote: ...a few days later, I see all those IDs turned to numbers (e.g. 32792)
At this point, what does the project's resource.h file look like?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Nothing especial, except some resources have similar IDs
// "Life is very short and is very fragile also." Yanni while (I'm_alive) { cout<<"I love programming."; }
|
|
|
|
|
Same here with VC.NET 2003:
The resources in the resource-editor and %PROJECT%.rc -file are the (correct) numbers, whereas the resource.h file has the (correct) ID-to-number table.
Annoying, but I could live with it. But as you mention it...
Failure is not an option - it's built right in.
|
|
|
|
|
If you use another "standard" IDs or Windows constants like windows styles (WS_MAXIMIZE) or attributes for some classes (PS_SOLID) and so on... are they ok? or have been transformed in their equivalent numbers too?
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
Sorry, I misunderstood what you mentioned.
Yes they are ok. I mean other resources like those I use for dialogs will be shown OK in "Resource view".
Everything OK, but menus.
// "Life is very short and is very fragile also." Yanni while (I'm_alive) { cout<<"I love programming."; }
|
|
|
|
|
Then, Sorry... but i dont understand what happens. All or none, but not some :S
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
Nelek wrote: All or none, but not some
I'm sorry, Englilsh is not my native language. I don't understand this sentence.
Anyway, the problem remained; IDs of my menus turn to numbers, and just menus have this behavior.
Thank you for your effort
// "Life is very short and is very fragile also." Yanni while (I'm_alive) { cout<<"I love programming."; }
|
|
|
|
|
I made a programm that compare two txt files. If they are different then a=1 otherwise a=0.
Here is the first txt file:
T18 DB2 CCI00002 <br />
C03CLI NYNR48400000 01100000002 00<br />
C03RES NYNR48400000 00500000015 00
Here is the seconde one:
T18 DB2 CCI00009 <br />
C03CLI NYNR48400000 01100000002 00<br />
C03RES NYNR48400000 00500000015 00
They are diferent only because of the bold underlined character.
But the value return is 0.
The programme used is:
int a=0;<br />
char c;<br />
char t;<br />
fstream file1;<br />
file1.open("file1.txt",ios::in);<br />
fstream file2<br />
file2.open("file2.txt",ios::in);<br />
while (i<114) {<br />
file1>>c;<br />
i=i+1;<br />
file2>>t;<br />
if (c!=t) <br />
{a=1;}<br />
}
it´s i<114 because i don´t want to compare the whole text file.
Does anyone have an idea of the reason why the returned value is 0 even if the files are different?
|
|
|
|
|
have you tried debugging and going trhough step by step? Take a look on the contents of every char in every loop of the while. You will maybe have a surprise
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
ok i will try that way, thank you!
|
|
|
|
|
Why use an int if you plainly want a bool ?
why increment i in the middle, which makes the code harder to read ?
have you tried stepping through the code to see what values are being read into c and t ?
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Christian Graus wrote: Why use an int if you plainly want a bool ?
because this is only a part of the main programm, there is another thing that can change the value of a into 2.
Christian Graus wrote: why increment i in the middle, which makes the code harder to read ?
You are right i should put it at the beginning
Christian Graus wrote: have you tried stepping through the code to see what values are being read into c and t ?
I am about to do it, maybe i should have done that before posting a message.
Thank you for your advise!
|
|
|
|
|
Where is the variable i initialized???
- NS -
|
|
|
|
|
It´s initialisated at the beginning of the programme, i only quote the pertinent part of the programme.
|
|
|
|
|
From your replies, I think you need to do a line by line comparison. If so you may have to skip white spaces and blank lines.
- NS -
|
|
|
|
|
It seems that space character isn´t considered as a character: i initiate i at 55 because i wanted to skip the first line (i know that i could use a pointer but i don´t know how it works) and the programme started to read from the 3rd line.
space isn´t considered as a character? I´ve read that it was part of the ASCII table.
Thank you all for your help and advise!
|
|
|
|
|
You should maybe try it with the getline () function, it reads spaces too. And then compare every position in your char set with the other one.
Or even better, if you are using VC++ use CString and the operator ==, CString::Compare () or CString::CompareNoCase ()
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
Thank you very much for your answer.
The fact is that i already have tryied to use getline() command. From a logical point of view, the programme is [to me] ok. But it doesn´t work. Therefore i get back to the command char.
|
|
|
|
|
What did you try?
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
I have tryed that:
c0..c3 and f01..f31 are declared as string (include < string >)<br />
<br />
getline(file1,c0);
getline(file1,c1); <br />
getline(file1,c2);<br />
getline(file1,c3);<br />
<br />
getline(file2,f01);
getline(file2,f11); <br />
getline(file2,f21);<br />
getline(file2,f31);<br />
<br />
if(f11==c1&&f21==c2&&f31==c3) <br />
{a1=1;}
But the thing is that i have to do that for 11 files. I think there is a problem with getline. I don´t know how to see the ´size´ of a line. Maybe the programme doesn´t considerer a line as a line in the text file.
|
|
|
|
|
From VC++ Help:
These functions extract data from an input stream as follows:
Variation Description
get();
Extracts a single character from the stream and returns it.
get( char*, int, char );
Extracts characters from the stream until either delim is found, the limit nCount is reached, or the end of file is reached. The characters are stored in the array followed by a null terminator.
get( char& );
Extracts a single character from the stream and stores it as specified by the reference argument.
get( streambuf&, char );
Gets characters from the stream and stores them in a streambuf object until the delimiter is found or the end of the file is reached. The ios::failbit flag is set if the streambuf output operation fails.
On the other hand...
istream& read( char* pch, int nCount );
istream& read( unsigned char* puch, int nCount );
istream& read( signed char* psch, int nCount );
Parameters
pch, puch, psch
A pointer to a character array.
nCount
The maximum number of characters to read.
Remarks
Extracts bytes from the stream until the limit nCount is reached or until the end of file is reached. The read function is useful for binary stream input.
Maybe one of this other options is better for you.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
THANK YOU!
That´s exactely what i needed! i am using dev c++ and i don´t have a help file about commands...
|
|
|
|
|
garfaoui wrote: i am using dev c++ and i don´t have a help file about commands...
But you do use the online-Version of the MSDN[^], do you?
Failure is not an option - it's built right in.
|
|
|
|
|
no i didn´t know this site. Thank you very much, i added this site to my favorites ^^
|
|
|
|
|
If you are only interested in comparing the first 114 characters of the file, and you don't care what those differences are, why not just read that much of each file into a buffer and then compare the whole buffer using memcmp() ?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|