Dev-c++ et serveur ftp

cobra176 Messages postés 86 Date d'inscription mercredi 1 novembre 2000 Statut Membre Dernière intervention 21 janvier 2009 - 25 janv. 2005 à 09:47
krokro6 Messages postés 66 Date d'inscription jeudi 8 avril 2004 Statut Membre Dernière intervention 28 juin 2007 - 21 juil. 2005 à 18:08
j'ai un probleme (encore ) avec dev-c++ concernant le serveur ftp
j'ai récupérer un code concernant le serveur ftp et j'ai essayer de l'assembler par dev-c++ avec la librairie winninet.h mais à la fin il me met

[Build Error] [main.o] Error 1

quelqu'un sait ce que c'est que cette erreur 1

merci pour l'information

4 réponses

magus54 Messages postés 41 Date d'inscription mardi 4 janvier 2005 Statut Membre Dernière intervention 29 avril 2006
25 janv. 2005 à 23:59
hmm ça peut être tout et n'importe quoi.Tu n'aurais pas le log de compilation en entier ??Ou sinon dit nous ou trouver le code que tu as récupéré..


Programming4ever
0
cobra176 Messages postés 86 Date d'inscription mercredi 1 novembre 2000 Statut Membre Dernière intervention 21 janvier 2009
26 janv. 2005 à 11:52
voici mon programme en entier

#include <windows.h>
#include <stdio.h>
#include <winsock2.h>
#include <ws2tcpip.h>
#include <WinINet.h>
main()
{
char *Buffer = (char *) calloc(sizeof (char), MAIN_LEN+1);
char NameServeurFtp[MAIN_LEN+1]="199.100.100.4";
char LoginFtp[MAIN_LEN+1]="FTPLOG";
char PwdFtp[MAIN_LEN+1]="FTPLOG";
bool ResultFtp;
char DirToRecupFile[MAIN_LEN+1]="";
char szLine[500];
char szFind[500];
char filename[260];
char caract,adresse;
char fullpath[260];
char caractere;
char fullpath1[260];
char fullpath2[260];
int i,j,longueur_txt_2,longueur_txt_1,RepRecherche;
char texte_1 [500];
char texte_2 [500];
char echange;
HINTERNET hinetopen, hinetconnect, hftpfirst;
WIN32_FIND_DATA struct_dir;
HKEY RegLogin, RegPass, RegServer;
DWORD Disposition, DispositionPass, DispositionServer;
DWORD Ltype;
char RLogin[100], RPasswd[100], RFtpServer[100];
LPTSTR lpRLogin = DATE;
LPTSTR lpRPasswd = DATE;
LPTSTR lpRFtpServer = 200.050.050.9;


/* Les handles */
HINTERNET hInternetSession; /* handle to internet connection */
HINTERNET hFTPSession;
hInternetSession = InternetOpen ( NameApp , INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);
if ( hInternetSession == NULL )
{
/* Erreur dans l'ouverture de la connexion */
WriteInLogFile ( "Erreur dans l'ouverture de la connexion " );
exit;
}

/* Connexion au serveur FTP */
hFTPSession = InternetConnect ( hInternetSession, NameServeurFtp, INTERNET_DEFAULT_FTP_PORT, LoginFtp, PwdFtp, INTERNET_SERVICE_FTP, 0, 0);
if ( !hFTPSession )
{
WriteInLogFile ( "Erreur dans l'ouverture de la connexion ftp " );
exit;
}
else
{




debut_boucle2 :
system("cls");
printf(" ***************************************************************\n");
printf(" * *\n");
printf(" * MOTEUR DE RECHERCHE D'INFORMATIONS DIVERS DANS LES ARCHIVES *\n");
printf(" * *\n");
printf(" ***************************************************************\n\n");
printf ("saisie le jour demander (exemple 01/02/02 = 010202) ou CTRL+C pour sortir : \n");
gets (texte_1);
strcpy(texte_2,texte_1);
longueur_txt_2 = strlen (texte_2);
j = longueur_txt_2 - 1;
longueur_txt_1 = strlen(texte_1);
for(i=0; i<longueur_txt_1; i+=2)
{
if(i+1<longueur_txt_1)
{
texte_2[i] = texte_1[longueur_txt_1-i-2];
texte_2[i+1] = texte_1[longueur_txt_1-i-1];
}
else
{
texte_2[i] = texte_1[longueur_txt_1-i-1];
}


texte_2[longueur_txt_1] = '\0';


}


strcpy(fullpath2, ".log");
strcat(texte_2,fullpath2);
strcpy(fullpath, "date");
strcat(fullpath,texte_2);
system("cls");
debut_boucle :
lecture = fopen(fullpath, "r");
ResultFtp = FtpGetFile ( hFTPSession, DirFile, DirToRecupFile, NULL, NULL,FTP_TRANSFER_TYPE_ASCII, NULL);
if ( ResultFtp )
{
putchar(caract);
}
else
{
printf( hDlgSend ,"Erreur de date!!!!","Erreur",);
}
printf("\n\nApuyez sur retour.");
fflush(stdin); scanf("%c",&caract);
}

si vous arriver à le faire marcher alors là chapeau
0
magus54 Messages postés 41 Date d'inscription mardi 4 janvier 2005 Statut Membre Dernière intervention 29 avril 2006
26 janv. 2005 à 21:38
Bon, j'ai lu ton truc. Je pense qu'il y a plein de problèmes !! Voici la source modifiée (j'ai mis en gras les modifs), elle se compile sans soucis sous dev.
#include <windows.h>
#include <stdio.h>
#include <winsock2.h>
#include <ws2tcpip.h>
#include <WinINet.h>
#define MAIN_LEN 100


using namespace std;
main()
{
char *Buffer = (char *) calloc(sizeof (char), MAIN_LEN+1);
char NameServeurFtp[MAIN_LEN+1]="199.100.100.4";
char LoginFtp[MAIN_LEN+1]="FTPLOG";
char PwdFtp[MAIN_LEN+1]="FTPLOG";
bool ResultFtp;
char DirToRecupFile[MAIN_LEN+1]="";
char szLine[500];
char szFind[500];
char filename[260];
char caract,adresse;
char fullpath[260];
char caractere;
char fullpath1[260];
char fullpath2[260];
int i,j,longueur_txt_2,longueur_txt_1,RepRecherche;
char texte_1 [500];
char texte_2 [500];
char echange;
HINTERNET hinetopen, hinetconnect, hftpfirst;
WIN32_FIND_DATA struct_dir;
HKEY RegLogin, RegPass, RegServer;
DWORD Disposition, DispositionPass, DispositionServer;
DWORD Ltype;
char RLogin[100], RPasswd[100], RFtpServer[100];
LPTSTR lpRLogin = "01/01/01";
LPTSTR lpRPasswd = "01/01/01";
LPTSTR lpRFtpServer = "200.050.050.9";
/* Les handles */
HINTERNET hInternetSession; /* handle to internet connection */
HINTERNET hFTPSession;
hInternetSession = InternetOpen ( NULL,INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0);


if ( hInternetSession == NULL )
{
/* Erreur dans l'ouverture de la connexion */
exit (1);
}

/* Connexion au serveur FTP */
hFTPSession = InternetConnect ( hInternetSession, NameServeurFtp, INTERNET_DEFAULT_FTP_PORT, LoginFtp, PwdFtp, INTERNET_SERVICE_FTP, 0, 0);
if ( !hFTPSession )
{
exit(1);
}else{
debut_boucle2 :
system("cls");
printf(" ***************************************************************\n");
printf(" * *\n");
printf(" * MOTEUR DE RECHERCHE D'INFORMATIONS DIVERS DANS LES ARCHIVES *\n");
printf(" * *\n");
printf(" ***************************************************************\n\n");
printf ("saisie le jour demander (exemple 01/02/02 = 010202) ou CTRL+C pour sortir : \n");
gets (texte_1);
strcpy(texte_2,texte_1);
longueur_txt_2 = strlen (texte_2);
j = longueur_txt_2 - 1;
longueur_txt_1 = strlen(texte_1);
for(i=0; i<longueur_txt_1; i+=2)
{
if(i+1<longueur_txt_1)
{
texte_2[i] = texte_1[longueur_txt_1-i-2];
texte_2[i+1] = texte_1[longueur_txt_1-i-1];
}else{
texte_2[i] = texte_1[longueur_txt_1-i-1];
}
texte_2[longueur_txt_1] = '\0';


}
strcpy(fullpath2, ".log");
strcat(texte_2,fullpath2);
strcpy(fullpath, "date");
strcat(fullpath,texte_2);
system("cls");
FILE * lecture;
LPCSTR DirFile;
debut_boucle :
lecture = fopen(fullpath, "r");
ResultFtp = FtpGetFile ( hFTPSession, DirFile, DirToRecupFile, NULL, NULL,FTP_TRANSFER_TYPE_ASCII, NULL);
if ( ResultFtp )
{
putchar(caract);
}else{
printf( "Erreur de date!!!!","Erreur");
}
printf("\n\nApuyez sur retour.");
fflush(stdin); scanf("%c",&caract);
}
}

Pour le compiler, tu fais
1 =>Nouvo projet=>App console
2=>tu colles le code dans la main.cpp
3=>Tu ajoutes les libs (projet->options->param->Ajouter lib)
Dev-Cpp/lib/libwsock32.a
Dev-Cpp/lib/libwininet.a
4=>F9
Moi j'ai pas de problème de compilation (a part quelques warnings à cause des NULL), mais le programme ne fais rien !! (il est censé faire quoi à la base)


Programming4ever
0
krokro6 Messages postés 66 Date d'inscription jeudi 8 avril 2004 Statut Membre Dernière intervention 28 juin 2007
21 juil. 2005 à 18:08
uai klr le prog il fou rien , c pourquoi ?
0
Rejoignez-nous