|
JPEG is big-endian.
EXIF follows TIFF specs which can be big or little endian.
This is usually determined by the first two bytes of the file:
"II" (0x49 0x49) for little endian, "MM" (0x4D 0x4D) for big endian.
For a file with "MM" byte order, tags (and all other multi-byte fields
of tags) will need to be swapped on Intel machines.
For the tag 0x9003, I would expect the following storage in the file:
Big endian: 0x90 0x03
Little endian: 0x03 0x90
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
thanks, I've got it working
|
|
|
|
|
BTW are you using Visual Studio? If so, open the jpeg file in the binary editor window.
It won't swap any bytes in the display.
File menu -> Open/File...
Select the file
Click the little drop arrow on the "Open" button and choose "Open with..."
Choose binary editor
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I looked up od
You should be using something like "-t x1" (or is it "-t xC") instead of "-x" on your command line since
you want single-byte hex integers, not double-byte integers.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
right! forget od in 16-bit mode.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
FYI:
I checked some JPEG documents and can confirm JPEG is "big-endian" which means multi-byte
quantities need their byte order reversed on a "little-endian" machine such as Intel's x86.
From the doc: "For parameters which are 2 bytes (16 bits) in length, the most significant
byte shall come first in the compressed data’s ordered sequence of bytes."
As already stated by Mark, this does NOT mean you should swap every pair of bytes; it does
mean if two bytes are to represent a 16-bit integer, then you should swap both bytes; if 4 bytes
represent a 32-bit integer, then you should swap all four bytes.
Since 2B and 4B integers will not always be properly aligned in memory, you will need
a method that interprets 2 bytes in the right order, whereever they are, as in the following
C# code snippet:
private byte getByte() {
return bytes[p++];
}
private ushort getShort() {
ushort bHi=getByte();
ushort bLo=getByte();
return (ushort)((bHi<<8)+bLo);
}
where bytes[] holds the entire file content, and p is the "current position".
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Hi,
What is "Byte Level Code" in C++?? When and How we are using?? Any tutorial regarding this topic...Thanks
-- modified at 9:25 Friday 28th September, 2007
|
|
|
|
|
spalanivel wrote: What is "Byte Level Code" in C++??
Byte level code is a term mostly associated with Java. Java compilers do not produce "machine code", they produce a machine independent code that was often called "byte code". To execute the byte code you need an interpreter specific to the machine (processor / architecture) because the processor can only execute machine code.
The original intent of C/C++ is to produce machine code. If there are non machine code C++ compilers then they would produce something that might be called byte level code meaning that it needs an interpreter because the processor can't execute it.
|
|
|
|
|
|
Hey everyone,
I've got a C++ console application and it goes into a loop while that never ends except when the user presses the ESC key! Right now my loop is coded like this:
while (!kbhit())
{ code }
I have to change the kbhit bit to make it so it only ends the loop when I press the ESC key!
Thanks for your help in advance, I appreciate it!
Michael
|
|
|
|
|
This seems to be unmanaged C++, if so you posted in the wrong forum.
Maybe this will do it: while(!kbhit()||getch()!=27) {...}
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Damn it. I just discussed this last week and I can't find the answer in my notes. I want to set the current cell. The documentation has an example in C# is...
myDataGridView->CurrentCell = myDataGridView(1, 1);
I can't do this in C++/CLI. What is the correct syntax to set the current cell?
Buck
|
|
|
|
|
Don't bother, I've got it. Amazing how I can spend an hour trying to do something and then figure it out 5 minutes after posting. It's...
myDataGridView->CurrentCell = myDataGridView->Rows[row]->Cells[col];
|
|
|
|
|
Hi Buck, did you solve your mail problems and get my message?
Regards
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Evidently not. I'll go bug my IT guy again.
|
|
|
|
|
Buck,
BuckBrown wrote: myDataGridView->CurrentCell = myDataGridView->Rows[row]->Cells[col];
You can also do this:
myDataGridView->CurrentCell = dataGridView1[col, row];
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
Thanks George,
I knew I had seen that syntax a couple of weeks ago. I kept trying to use parenthesis instead of brackets.
|
|
|
|
|
Thanks all for your input on my DataGridView question.
I am using visual 2005 C++/CLI. This seems like it should be pretty straight forward but I'm not doing so well at googling info on it. I have a Form1 that has a button on it that, when clicked, instantiates a Form2. After working on Form2 I would like to click a button on Form2 to update a file. The "UpdateFile()" function is a method of the Form1 class. I thought something like this->Parent->updatefile() or this->Owner->UpdateFile() might work but it doesn't. I am not real familiar with the Windows Owner/Parent/Child relashionships. How do I "look back" to the class that instantiated me and access one of that classes functions? Or can I?
Thanks
Buck
|
|
|
|
|
I'll reply to my own question. I believe I should use a delegate to do this.
|
|
|
|
|
That is dead right my friend!!
Rocky
You can't climb up a ladder with your hands in your pockets.
|
|
|
|
|
Hi Rocky,
I,m having some problems with this because all of the examples and documentation I have found show a delegate and a single class used from main(). I'm having a problem with a circular definition.
//-----This is in Class1.h------
#include "Class2.h"
delegate void MyDelegate();
public ref class Class1 : public System::Windows::Forms::Form
{
private: void UpdateFile()
{
// Body of Method
}
private: System::Void buttonAdvanced_Click(System::Object^ sender, System::EventArgs^ e)
{
Class2^ myclass2 = gcnew Class2();
myclass2->ShowDialog();
}
};
//-----This is in Class2.h------
#include "Class1.h" // I CAN"T DO THIS. THIS CLASS IS ALREADY INCLUDED IN Class1.h
public ref class Class2 : public System::Windows::Forms::Form
{
private: System::Void buttonUpdateFile_Click(System::Object^ sender, System::EventArgs^ e)
{
Class1^ myclass1 = gcnew Class1();
MyDelegate^ update_file = gcnew MyDelegate(myclass1, &Class1::UpdateFile);
}
};
The problem here is that I can't define MyDelegate^ update_file unless I #include Class1.h but class1.h already is #including Class2.h so the Class2 Form can be displayed, thus creating a circular dependancy. I haven't found any documentation on how to do what I am trying to do.
Thanks
Buck
|
|
|
|
|
Hi everyone,
We are developing a C++/CLI interfacing layer for our managed c# clients to talk to a legacy c++ app... we need to convert the DOTNET basic types like double, float, byte, short, string int values to void*
How should i do it
|
|
|
|
|
dreamz6480 wrote: convert
dreamz6480 wrote: to void*
Do you know what that means? .NET memory is managed you don't want the pointer to a .NET variable do you?
Based on your post I have no idea what your requirements are, one guess would be that you want to marshal the .NET memory to native memory[^], once you have the values in native memory I assume you know how to get the pointer to it.
|
|
|
|
|
If I were to need an interface between managed C# code and unmanaged C++ code, I would
do it in a C# class, I see no reason to put a third language in the middle.
And it would boil down to some P/Invoke stuff; for most value types there is a simple
1-to-1 correspondence (be careful with bool and long).
For reference types, things get more complicated. strings are simple, so are structs of
value types. Arrays and nested struct/classes may get tough.
Luc Pattyn [Forum Guidelines] [My Articles]
this weeks tips:
- make Visual display line numbers: Tools/Options/TextEditor/...
- show exceptions with ToString() to see all information
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Hello Everyone,
well I got a bit peculiar problem here for u!
I've been given a program that is about making a Windows Service and it was developed in Visual C++ 6 and later converted to C++ .NET 1.1. Its using the CService Class. The thing they want me to find out is to how we can change the 'Startup Type' of that Windows Service after it has been installed.
Is this possible? if not then is it necessary for us to specify the startup type when installing the windows service.
Hope to hear from u ppl on this, any comments, suggestions are welcomed
Thanks in advance!
Rocky
You can't climb up a ladder with your hands in your pockets.
|
|
|
|