[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Re: [CPROG] C-programmering i MS Visual Studio



Hi.

> funktionen atoi hvad gør den egentligt?? Sikrer at en
> given input ER en integer eller??

Konverterer den del af en streng som er et tal, til et tal..
  ehem. altså....



#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main()
{
  char string1[]="123abc";
  char string2[]="abc123";
  char string3[]="abc";
  char string4[]="123";
  printf("%s: %d\n",string1,atoi(string1));
  printf("%s: %d\n",string2,atoi(string2));
  printf("%s: %d\n",string3,atoi(string3));
  printf("%s: %d\n",string4,atoi(string4));
  return 0;
}


output:

123abc: 123
abc123; 0
abc: 0
123: 123



   bean


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 20:09 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *