strtok

    0熱度

    1回答

    我的網址是這樣的: http://domain.net/news.php?url=/abcd.html 我需要剝離.PHP URL =到URL是這樣的: http://domain.net/news/abcd.html 剛嘗試過: 修改.htaccess文件:RewriteRule ^news/(.*) news.php?url=$1 [L,QSA] 看跌的strtok在news.php:

    0熱度

    1回答

    我寫一個程序,讀取一起含有我的數據與測量例如爲單位的文本文件: 8.9837 ns , 8.9826 ns , 8.8998 ns , 9.0433 ns , 143.5 ps 13.037 ns , 13.027 ns , 12.983 ns , 13.075 ns , 91.1 ps -16.18 mV , -17.842 mV , -39.78 mV , -9.44 mV , 30.34

    -3熱度

    2回答

    我想用strtok()當分隔符是一個字符串,如 " break point " 即 This is the first part. break point This is the second part 成爲: This is the first part. This is the second part 問題是當我包含空格時,它也實現了每個空格。 下面是相關代碼: char seps[5]

    -2熱度

    1回答

    所以基本上我不知道如何處理這個命令,我搜索了各地的論壇,並可以理解如何打印字符串和使用指針,但我想分割字符串並將所有令牌保存在不同的變量中。 我試圖做這樣的事情 char s[20],*pt,name[10]; pt=strtok(s," "); 現在我想節省名字符串的第一個土氣,但我得到了終端和唯一可行的事情上的錯誤(只路過指針)只給我1個字母。 name=pt; does not wor

    4熱度

    4回答

    您能幫我嗎?我的代碼不符號化,所以我創造了這樣的代碼: 我分配一些內存, 我strcpy(malloced_memory, argv) 我執行strtok(mallocted_memory, ".") 嘗試free(mallocted_memory)。 filename = malloc(strlen(argv)); strcpy(filename, argv); strk_ptr = ma

    0熱度

    1回答

    我已經下面的結構 typedef struct PATH{ int server1; int server2; int weight; }PATH; 這些都存儲在數組中。 我正在使用以下函數將數組序列化爲字符串。 char* serialize(PATH** arr, int sz){ char* buffer = calloc(50, sz * 6

    3熱度

    3回答

    這裏是我的問題:我要地圖文件「FILENAME.TXT」,基本上由兩對每行字符串的: "string1 string2 string3 string4 string5 string6..." ,然後我想使用的strtok來分隔不同的字符串。 所以我的文件映射是這樣的: // open file if ((fdsrc = open("filename.txt", O_RDONLY)) <

    0熱度

    1回答

    考慮下面的程序 #include <stdio.h> #include <string.h> int main() { char *str = "This is a test."; char *token; token = strtok(str," "); } 它會出現段錯誤。但是,如果我將* str改爲str [80],則不會。爲什麼是這樣? 謝謝

    0熱度

    1回答

    我有一個名爲temps的字符數組傳遞給一個函數。該格式將永遠是這樣的: 1 1.1 我想將它拆分並保存這兩個數。這是他們之間的空間,但經過研究strtok(),我不知道它是如何工作的。 void seperate(char *tempformat){ char s1[10]; char s2[10]; s1 = strtok(); s2 = strtok(

    0熱度

    5回答

    我有可能會或可能不會包含某些分隔符,並使用strtok在一個字符串分隔符之後刪除一切,例如字符串列表: $href = "test#content"; $href = strtok($href,'#'); echo $href; 輸出: test 但是,當字符串以分隔符開頭時,我遇到了一個問題: $href = "#content"; $href = strtok($href,'#'