C программа для разделения электронной почты te на основное и доменное имя
hello this is my assignment i have to write a c program to split an email into main and domain name. please anyone can help me to write a code that split the email.
Что я уже пробовал:
#include<stdio.h> #include<string.h> #include<stdlib.h> main() { FILE*fp=fopen("m.csv","r+"); const char s[2]=","; // here s is constant. It can't be reasign another string but we can assign another character value at s[index] char*token; // Char* is a pointer that points to a token. Tokens are the smallest units that make a complete C program int i; if(fp!=NULL) { char line[30]; while(fgets(line,sizeof line,fp)!=NULL) { token=strtok(line,s); // Strtok break the String into tokens. It search for comma and when it is found it stores the preceding value into an array and so on for(i=0;i<2;i++) { if(i==0) { printf("%s",token); token=strtok(NULL,s); } else { printf("%s",(token)); } } } fclose(fp); } }
Richard MacCutchan
Какой формат "электронной почты" вам нужно разделить?
[no name]
Что не так с кодом, который у вас есть?
ZurdoDev
Где ты застрял?