> Tous les forumsAutres langages

 Aide en langage C
Statut du sujet : NON RESOLU Imprimer
 koutora
  Posté le 22/11/2005 @ 05:39  
 Petit astucien

75 Messages
Bonjour, J'ai un programme et je souhaiterais le convertir en langage C. S'il y a une belle âme pour m'aider, je suis preneur et je lui serais d'une grande reconnaissance !!! Voici le programme : ******************************************************** ******************************************************** /* * getstr.h * * * Created by Ousmane Loum on 11/19/05. * Copyright 2005 __MyCompanyName__. All rights reserved. * */ function getstr, txt, help=hlp if (n_params(0) lt 1) or keyword_set(hlp) then begin print,' Get delimited strings from a text string or array.' print,' s = getstr(txt)' print,' txt = input text string or string array. in' print,' s = Returned array of strings found. out' print,' Notes: Delimited strings must be surrounded by' print,' a single or double quote. The other type of' print,' quote may be contained within the delimited string.' print,' The strings may be separated by white space, commas,' print,' or any other kind of separator.' print,' If no strings are found a null string is returned.' print,' Only delimited strings are returned, all other items' print,' are ignored.' return, '' endif n = n_elements(txt) ; Number of lines to search. sa = [''] ; Seed array. ;------- Loop through input lines ------------- for i=0, n-1 do begin t = txt(i) ; Extract i'th line loop: len = strlen(t) ; Length of this line. p1 = strpos(t,"'") ; Look for '. p2 = strpos(t,'"') ; Look for ". if (p1>p2) lt 0 then goto, skip ; No strings in line. p = -1 ; Don't know delimiter position yet. if p1 lt 0 then p=p2 ; Correct position was p2. if p2 lt 0 then p=p1 ; Correct position was p1. if p lt 0 then p=p1<p2 ; Take first position. d = strmid(t,p,1) ; Pick off delimiter. b = byte(t) eq (byte(d))(0) ; Find string limits. w = [where(b eq 1),len] ; Where are they? Add end of string. lo = w(0)+1 ; String start. hi = w(1)-1 ; End of string. sa = [sa,strmid(t,lo,hi-lo+1)] ; Pick off string. t = strmid(t,hi+2,999) ; Drop front of line. if t ne '' then goto, loop ; Keep looking. skip: endfor ; i if n_elements(sa) eq 1 then begin ; No strings found. return, '' endif else begin ; Drop seed value. return, sa(1:*) endelse end
 Afficher le profil de koutora Envoyer un message privé à koutora
 
 
Publicité
 bebe en detresse  Posté le 26/11/2005 à 14:32  
Petit astucien

40 Messages
salut, tout dabor précise stp dans quel language tu a ecri ce programme. question a part: pourquoi veu tu le mettre en language C++? bonne continuations
Afficher le profil de bebe en detresseEnvoyer un message privé à bebe en detresse
 Revenir en haut de la page
Haut de la page 
Inscrivez-vous !
- Posez vos questions

- Résolvez vos problèmes

- Aidez les autres

- Participez et créez vos discussions

- Dialoguez en privé avec d'autres membres

- Suivez vos sujets préférés

- Affichez les signatures des membres

TOUT EST GRATUIT !

Je crée mon compte



Vous avez besoin d'aide ?
Des centaines d'experts sont à votre disposition sur les forums PC Astuces pour vous aider gratuitement, 24h/24, 7j/7.

Les derniers sujets résolus !
 

 > Tous les forumsAutres langages

 
Forum PC Astuces© 1997-2008 WebastucesAller en haut de la page