root/win_port.c
| Revision 106, 1.5 kB (checked in by ng, 5 years ago) |
|---|
| Line | |
|---|---|
| 1 | /*************************************************************************** |
| 2 | * This file is part of the 'gemmes' project * |
| 3 | * * |
| 4 | * * |
| 5 | * Copyright (C) 2007 by * |
| 6 | * GARCH Soufiane * |
| 7 | * GUILLAUME Nicolas <ng@ngsoft-fr.com> * |
| 8 | * * |
| 9 | * * |
| 10 | * This program is free software; you can redistribute it and/or modify * |
| 11 | * it under the terms of the GNU General Public License as published by * |
| 12 | * the Free Software Foundation; version 2 of the License only. * |
| 13 | * See the COPYING file. * |
| 14 | ***************************************************************************/ |
| 15 | |
| 16 | |
| 17 | #include <windows.h> |
| 18 | #include <winbase.h> |
| 19 | #include <stdio.h> |
| 20 | #include <stdlib.h> |
| 21 | |
| 22 | |
| 23 | #define M_MAXSIZE 1024 |
| 24 | |
| 25 | /* implementation simple de getline() pour windows */ |
| 26 | unsigned int getline(char **lineptr, unsigned int *n, FILE *stream) |
| 27 | { |
| 28 | if(!*lineptr) |
| 29 | { |
| 30 | *lineptr = (char*)malloc(M_MAXSIZE); |
| 31 | *n = M_MAXSIZE; |
| 32 | } |
| 33 | |
| 34 | if(!fgets(*lineptr, M_MAXSIZE, stream)) |
| 35 | return (unsigned int)-1; |
| 36 | |
| 37 | return strlen(*lineptr); |
| 38 | } |
| 39 | |
| 40 | |
| 41 | void usleep(unsigned int s) |
| 42 | { |
| 43 | Sleep(s / 1000); |
| 44 | } |
| 45 | |
| 46 |
Note: See TracBrowser for help on using the browser.
