Howdy,
I am reading a binary log file produced by a piece of equipment.
I have the data in a byte[].
If I need to read two bytes to create a short I can do something like this:
short value = (short)(byte[1] << 8);
value += byte[2];
Now I know the value is the correct for valid data.
How would I know if the file was messed up...
Problem: I have an integer; this integer needs to be converted to a stl::string type.
In the past, I've used stringstream to do a conversion, and that's just kind of cumbersome. I know the C way is to do a sprintf, but I'd much rather do a C++ method that is typesafe(er).
Is there a better way to do this?
Here is the stringstream ap...
Has anyone converted a large (ours is 550,000 lines) program of Fortran 77 code to C++ ? What pitfalls did you run into ? Was the conversion a success ? Did you use a tool like for_c ( http://www.cobalt-blue.com/fc/fcmain.htm ) ? Was the resulting C++ code significantly faster or slower ?
...
What my users will do is select a PDF document on their machine, upload it to my website, where I will convert into an HTML document for display on the website. The document will be stored in a database after conversion.
What's the best way to convert a PDF to HTML?
I have been handed a requirement where a user would create a "news" s...
Hey guys,
I've got a cool piece of code taken from a VC++ project which gets complete information of the hard disk drive WITHOUT using WMI (since WMI has got its own problems)
I ask those of you who are comfortable with API functions to try to convert this VB6 code into VB (or C#) .NET and help A LOT of people who are in great need of th...
What's the quickest way to convert a date in one format, say
2008-06-01
to a date in another format, say
Sun 1st June 2008
The important bit is actually the 'Sun' because depending on the dayname, I may need to fiddle other things around - in a non-deterministic fashion. I'm running GNU bash, version 3.2.17(1)-release (i386...
These days, many projects have started their life written in Java. Some of them are eventually converted to C# for incorporation in .NET. Examples that come to mind are log4net, nhibernate and db4o.
Including sharpen (which is db4o's tool) have you seen and/or used any tools that make continual conversion manageable. I'd go so far as...
I need to convert several Java classes to C#, but I have faced few problems.
In Java I have following class hierarchy:
public abstract class AbstractObject {
public String getId() {
return id;
}
}
public class ConcreteObject extends AbstractObject {
public void setId(String id) {
this.id= id;
}
}
The...
I'm currently refactoring code to replace Convert.To's to TryParse.
I've come across the following bit of code which is creating and assigning a property to an object.
List<Person> list = new List<Person>();
foreach (DataRow row in dt.Rows)
{
var p = new Person{ RecordID = Convert.ToInt32(row["ContactID"]) };
list.Add(p);
}...
What is the best way to convert an Int value to the corresponding Char in Utf16, given that the Int is low enough?
Boaz
...
How can I create a program to convert binary to decimal using a stack in C#?
...
What is the most direct and/or efficient way to convert a char[] into a CharSequence?
...
In C# if I want to convert a double (1.71472) to an int then I get the answer 2. If I do this in Java using intValue() method, I get 1 as the answer.
Does Java round down on conversions?
Why do the Java API docs have such scant information about their classes i.e.
Returns the value of the specified
number as an int. This may in...
hi guys
Well I testing my jython program, that does some neat [".xls", ".doc", ".rtf", ".tif", ".tiff", ".pdf" files] -> pdf (intermediary file) -> tif (final output) conversion using Open Office. We moved away from MS Office due to the problems we had with automation. Now it seems we have knocked down many bottles related to show sto...
A C-program is placing what it considers to be 64-bit unsigned integers into a column in a Postgres database that is typed as int8.
To Postgres, int8 is always 'signed int8' (no such thing to it as 'unsigned int8').
So the Ruby program I have shows numbers retrieved from Postgres in the upper half of that space as negative.
What is the ...
Is is there some sort of library that would allow me to convert a speex file to an mp3 file? If it were do-able from php that would be even better, but really anything would probably work.
...
In many languages there's a pair of functions, chr() and ord(), which convert between numbers and character values. In some languages, ord() is called asc().
Ruby has String#chr, which works great:
>> 65.chr
A
Fair enough. But how do you go the other way?
"A".each_byte do |byte|
puts byte
end
prints:
65
and that's pretty clo...
Is there something similar to sprintf() in C#?
I would for instance like to convert an integer to a 2-byte byte-array.
Something like:
int number = 17;
byte[] s = sprintf("%2c", number);
...
All my applications are developed in Native Code. I am hesitant to move to .Net because of all the negatives that I hear, such as:
Slow response time
Lock-In into Windows
Dependance on huge .Net run-time that makes installation a pain and slow as well.
etc. etc.
Your advice will be much appreciated.
...
Ghostscript curls up and dies, throwing an exception to stdout which I cannot catch and log. I am pretty sure it gets sick when I give it asian fonts. Has anybody backed into this problem and solved it?
...