Diviser fichier

Résolu
karras13 Messages postés 1 Date d'inscription lundi 23 août 2004 Statut Membre Dernière intervention 26 avril 2005 - 26 avril 2005 à 00:27
garslouche Messages postés 583 Date d'inscription mardi 26 novembre 2002 Statut Membre Dernière intervention 29 mai 2015 - 26 avril 2005 à 08:57
salut à tous ,je cherche a diviser un fichier en plusieurs fichiers avec le langage C.
mon deuxieme question est de savoir comment ecrire la fonction logarithme nuperien avec lunix en C.svp repondez moi le plutot possible meme sur mon adresse mail :
trabelsimustapha@yahoo.fr

2 réponses

cs_Matt67 Messages postés 549 Date d'inscription samedi 6 septembre 2003 Statut Membre Dernière intervention 6 mars 2010 3
26 avril 2005 à 06:13
bonjour,



#include <stdio.h>



#define TAILLE 1000



int main()

{

char szFichierOriginal[] = "c:\\temp\\toto.dat";

char szFichierCoupe[255];

char szBuffer[TAILLE];

size_t i 0, BitRead 0;

FILE *fpLecture, *fpEcriture;



fpLecture = fopen(szFichierOriginal, "rb");

if(!fpLecture)

return 1;



BitRead = fread(szBuffer, 1, TAILLE, fpLecture);

while(BitRead > 0)

{

sprintf(szFichierCoupe, "%s%02d", szFichierOriginal, i);

fpEcriture = fopen(szFichierCoupe, "wb");

if(!fpEcriture)

{

fclose(fpLecture);

return 1;

}

fwrite(szBuffer, BitRead, 1, fpEcriture);

fclose(fpEcriture);

BitRead = fread(szBuffer, 1, TAILLE, fpLecture);

i++;

}



fclose(fpLecture);



}


Matt...
3
garslouche Messages postés 583 Date d'inscription mardi 26 novembre 2002 Statut Membre Dernière intervention 29 mai 2015 1
26 avril 2005 à 08:57
Pour la première question tu as un tas de sources sur ce site, cherche le mot 'splitter'

Pour la seconde question regarde dans mes sources : "Les fonctions de math.h reprogrammées"

On ne force pas une curiosité, on l'éveille.
.................................................Daniel Pennac
0
Rejoignez-nous