Index: /trunk/FACT++/src/Converter.cc
===================================================================
--- /trunk/FACT++/src/Converter.cc	(revision 10355)
+++ /trunk/FACT++/src/Converter.cc	(revision 10356)
@@ -848,2 +848,39 @@
     return ret;
 }
+
+void Converter::ToFits(void* dest, const void* src, size_t size)
+{
+	//crawl through the src buffer and copy the data appropriately to the destination buffer
+	//Assumption: the string is always last. This way we use the provided size to determine the number
+	//of character to copy
+	char * charDest = static_cast<char*>(dest);
+	const char* charSrc = static_cast<const char*>(src);
+	size_t cOffset = 0;
+	int elemSize = 0;
+
+	for (unsigned int i=0;i<fList.size()-1;i++)
+	{
+		if (fList[i].first.first->name()[0] == 'S') //string
+		{
+			for (size_t j=cOffset;j<size;j++)
+				charDest[j] = charSrc[j];			
+			continue;
+		}
+		
+		elemSize = fList[i].first.second;
+		for (int j=0;j<fList[i].second.first;j++)//for all elements of this column
+		{
+			for (int k=0;k<elemSize;k++)//swap the element bytes
+				charDest[cOffset+k] = charSrc[cOffset + elemSize - (k+1)];
+			cOffset += elemSize;
+		}
+	}
+}
+
+
+
+
+
+
+
+
Index: /trunk/FACT++/src/Converter.h
===================================================================
--- /trunk/FACT++/src/Converter.h	(revision 10355)
+++ /trunk/FACT++/src/Converter.h	(revision 10356)
@@ -90,4 +90,6 @@
 
     static std::string GetHex(const void *d, size_t size, size_t chunk=1);
+    
+    void ToFits(void* dest, const void* src, size_t size);
 
 /*
