This expression has type unit but is here used with type string
Bonjour,
j'ai fais un petit programme qui se connecte à un serveur IRC, le seul problème ( pour l'instant ) est que je n'arrive pas à répondre aux ping, mon code me renvoye une erreur :
Code:
1 2 3 4 5 6
| try
Str.search_forward (Str.regexp "^PING :") r 0; (* Ligne 26 *)
let pong_answer = List.hd (Str.split (Str.regexp "PING :") r) in
output_string oc "PONG :"^ pong_answer ^"\n"; (* Ligne 28 *)
print_string "\n\nPING -> PONG\n\n"
with Not_found -> (); |
Me donne :
Code:
1 2 3 4 5 6
| $ ocaml unix.cma str.cma irc.ml
[...]
File "Lilith.ml", line 26, characters 4-49:
Warning S: this expression should have type unit.
File "Lilith.ml", line 28, characters 4-29:
This expression has type unit but is here used with type string |
Quelqu'un aurais une solution ?
Merci .