当前位置: 技术问答>linux和unix
windows C转成Linux C
来源: 互联网 发布时间:2016-10-13
本文导语: typedef stUserListNode* UserList; stUserListNode GetUser(char *username) { for(UserList::iterator UserIterator=ClientList.begin(); UserIterator!=ClientList.end(); ++UserIterator) { if( strcmp( ((*UserIterator)->userName), username) == 0 ) return *(*User...
typedef stUserListNode* UserList;
stUserListNode GetUser(char *username)
{
for(UserList::iterator UserIterator=ClientList.begin();
UserIterator!=ClientList.end();
++UserIterator)
{
if( strcmp( ((*UserIterator)->userName), username) == 0 )
return *(*UserIterator);
}
printf("not find this usern");
}
new
这些改如何转成Linux下C
stUserListNode GetUser(char *username)
{
for(UserList::iterator UserIterator=ClientList.begin();
UserIterator!=ClientList.end();
++UserIterator)
{
if( strcmp( ((*UserIterator)->userName), username) == 0 )
return *(*UserIterator);
}
printf("not find this usern");
}
new
这些改如何转成Linux下C
|
struct list
{
char userName[200];
struct list *next;
}
struct list *head = NULL;//头节点
struct list *curr = NULL;//当前节点
/*假设你已经装了很多的数据*/
struct list* GetUser(char *username)
{
struct list *tmp = NULL;
for(tmp = head; tmp != NULL; tmp++)
{
if(strcmp(tmp->userName, username) == 0)
return tmp;
}