comment convertir un int 32 en un int 64 ?
je veux r�cuper la longueur d'un file stream (fs->lenght) et la convertir en un string :
Code:
1 2 3
|
int ^i = fs->lenght;// ca marche pas puisque fs->lenght est un int64 alors que i est un int 32
string^stri= i->Tostring; |
comment convertir un int 32 en un int 64 ?
comment convertir un int 64 en un int 32 ?
c plutot l'inverse
comment convertir un int 64 en un int 32 ?
merci d'avance
je mets un string dans un fichier texte mais quand je l'ouvre il ya des caract bizzar
normalement , je dois obtenier un fichier texte avec les noms des fichiers et leur taille sous forme de string
mais j'obtient un fichier text avec des caract�res bizarres????
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
files = Directory::GetFiles(path);
DirectoryInfo^ di = Directory::CreateDirectory(pathnew);
for each (file in files)
{
String ^v= file->Substring(path->Length);
if (!compresserFichier(file, pathnew+v+".gz"))
Console::WriteLine("failure in compression");
FileStream ^fs = gcnew FileStream(file+".gz", FileMode::Open);
BinaryReader ^br = gcnew BinaryReader(fs);
Int64 ^j =fs->Length();
String ^jstr = j->ToString();
str = +file+","+jstr+";";
//str = ""+file;
br->Close();
fs->Close();
} |
et apr�s dans le main:
Code:
1 2 3 4 5 6
|
CompressDir(textBox1->Text,textBox2->Text);
StreamWriter ^sw = gcnew StreamWriter("c:\\mytest.txt");
sw->Write(str);
sw->Close(); |
comment je pourrais tt simplement passer d'un int � un String et inversement ?
voil� j'ai r�cup�r� un int et je l'ai convertis en String
mais pour le convertir je suis pass� par un int32
Code:
1 2 3 4
| int i = 9 ;
int^j ; //j est un int32
j= i ;
String ^jj = j->ToString(); |
donc pour r�cup�rer le Int je convertis le String en Int32
mais par contre je peux pas mettre le Int32 dans le int
est ce que t'a une id�e comment je pourrais tt simplement passer d'un int � un String et inversement ?
merci
est ce que (fs->Length) est un int 64?
voila je r�cup�re un string o� il y a un int64 , ce int64 contient le nombre de bytes que je veux lire � partir du fichier ouvert
Code:
1 2 3 4 5 6 7 8 9
|
Int64 ^filelength=System::Convert::ToInt64(fileleng);
FileStream ^fs1 = gcnew FileStream(dirSource, FileMode::Append);
BinaryReader ^br1 = gcnew BinaryReader(fs1);
FileStream ^fws1 = gcnew FileStream(filename, FileMode::CreateNew);
BinaryWriter ^bw1 = gcnew BinaryWriter(fws1);
bw1->Write(br1->ReadBytes((int)filelength));//ici il m'affiche une erreur comme quoi il ne peut pas convertir un int64 en un int
aussi : bw1->Write(br1->ReadBytes(filelength)); ca marche pas |
est ce que tu as une id�e comment je pourrais r�soudre ce pb ?
merci d'avance