On March 14, YAN HONG YE wrote:
On Tue, 13 Mar 2012 02:28:38 +0000, YAN HONG YE <yanhong.ye at mpsa.com>
wrote:

>here my code,where is wrong?
>char mma[250];
>strcpy(mma,"sqlite3 foods.db \" .separator ',' \" \".import dzhhkmysql.txt 
dzh\"");
>system(mma);

dot-commands for the sqlite3 command line tool have to be on separate
lines.

Do the equivalent of:
printf ".separator ','\n.import dzhhkmysql.txt dzh\n" | sqlite3 foods.db

C:\sqlite\lib>".separator ',' \n .import ddl.txt dzh \n" | sqlite3 foods.db
The system cannot find the path specified.
but the two file ddl.txt and foods.db certainty under C:\sqlite\lib\

The above text is not usefully interpreted by the brain-dead command line shell that comes with operating systems using the weird drive letter convention and needlessly different backslash. I advise getting a better shell at http://jpsoft.com/index.php, where a free, light version can be obtained. (See http://jpsoft.com/downloads/v13/tccle.exe .) Once you have that, take a look at the 'text' and 'endtext' commands, which allow convenient generation of text containing embedded line-ends from a batch file. Alternatively, if you love cmd.exe for some strange reason, use a series of 'echo' commands to get lines into a temp file, then redirect that into the sqlite3.exe shell. (This is crude, but can work.) Another alternative is to get bash.exe from the MSYS package within the MinGW project. That shell is one written by people who understand the programmer's task, unlike cmd.exe which is one of the sorriest excuses for a shell ever allowed to live so long.

Good luck,
--
Larry Brasfield
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to