OSDN Git Service

addid library source 20140221
[zither/ds-zither.git] / libms / swap_mem.c
1 // swap_mem.c
2 // $Id: swap_mem.c,v 1.1.1.1 2007/09/19 05:49:54 sendan Exp $
3 // masashi shimakura
4
5 #include<stdio.h>
6 #include<string.h>
7
8
9 /*------------------ SWAP MEM -------------------*/
10 int swap_mem( char data[], char chA, char chB )
11 {
12 int inA, ret, count;
13 inA = 0;
14 ret = 0;
15
16 count = (int)strlen(data);
17
18 if(0 < count){
19    for(; inA < count; ){
20       if( data[inA] == chA ){
21          data[inA] = chB;
22          ret++;
23          }
24       inA++;
25       }
26    }
27
28 return(ret);
29 }
30
31