In C#, would something like this work? Key is setting the length of the input parameter when you create it. You didn't indicate what type @o is so I assumed it was int.
private int CallProc(int inputParmLength, string inputParmValue)
{
int outputValue = -1;
using (SqlConnection conn = new SqlConnection("[your connection string here]"))
{
SqlCommand cmd = new SqlCommand();
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "xp_test";
SqlParameter parm1 = new SqlParameter("@i", SqlDbType.VarChar, inputParmLength);
SqlParameter parm2 = new SqlParameter("@o", SqlDbType.Int);
parm1.Value = inputParmValue;
parm2.Direction = ParameterDirection.Output;
cmd.Parameters.Add(parm1);
cmd.Parameters.Add(parm2);
conn.Open();
int affectedRows = cmd.ExecuteNonQuery();
outputValue = (int)cmd.Parameters["@o"].Value;
conn.Close();
}
return outputValue;
}