flyhoney Posted June 21, 2006 Share Posted June 21, 2006 I run an open source music website where users upload project files from different music creation applications. I have been trying to write a script that will extract useful information from the project files, like application used, version number, plugins etc.. The infomation I need from the file is delimited by Ä and Á. I have been trying to use fscanf to grab the strings with the information I need out of the file, but I cannot seem to get it to work. My code is something like this:[code]$filename = "some/file.dat";$file = fopen ($filename, "r");while ($file_info = fscanf($file, "Ä%sÁ")) { list ($version) = $file_info; echo "$version<br>";}fclose($file);[/code]However this is not really working. Any help would be greatly appreciated.*I should add that I am viewing the files in a hex editor and that is how I know how the information I want is delimited. Link to comment https://forums.phpfreaks.com/topic/12499-extracting-information-from-a-file-with-fscanf/ Share on other sites More sharing options...
redarrow Posted June 21, 2006 Share Posted June 21, 2006 try this ok.example[code]$filename = "some/file.dat";$file = fopen ($filename, "r");while ($file_info = fscanf($file, "%Ä\s%Á\n")) { list ($version) = $file_info; echo "$version<br>";}fclose($file);[/code] Link to comment https://forums.phpfreaks.com/topic/12499-extracting-information-from-a-file-with-fscanf/#findComment-47859 Share on other sites More sharing options...
flyhoney Posted June 21, 2006 Author Share Posted June 21, 2006 Thanks for the suggestion. I tried it out, and this is the warning I get: Warning: fscanf() [function.fscanf]: Bad scan conversion character "Ä" Link to comment https://forums.phpfreaks.com/topic/12499-extracting-information-from-a-file-with-fscanf/#findComment-47863 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.