R
Richard Bos
Francesco Zavatarelli said:1)the c compiler I'm using is "Miracle C" see http://www.c-compiler.com
anybody knows it? Anybody can give me an advice of a low cost c compiler?
I'm currently using Dev-C++ (which also does C), and quite satisfied:
2)and I am having a lot of troubles with the code. It seems it is not
related to the ' ' inside the string.
No, it's partly related to the \s inside the string.
char* NAME_SMS = "C:\Programmi\Palm\Tungst\Backup\SmsDB.PDB";
Imprimis, this isn't right in any case. You had it right the first time:
the \ is the escape character, and if you want a literal \ in a string,
it must be escaped itself.
Secundis, maybe Miracle C can't handle non-DOS path names. Try replacing
"Programmi" with the short name of that directory, probably "progra~1".
file_sms = fopen(NAME_SMS, "r");
Oh, btw: a .PDB-file is probably a binary file (it's a kind of database,
isn't it?, so you want to open it "rb". Not that this should cause
fopen() to fail, but once you do manage to open it, using "r" could
cause some surprises when you read from it.
if I use char* NAME_SMS = "C:\Programmi\Palm\Tungst\Backup\SmsDB.PDB";
I get the error:
main.c: line 21: lexical: unknown escape sequence `\P'
Well, yes. Why did you change this, anyway?
If I use char* NAME_SMS = "C:/Programmi/Palm/Tungst/Backup/SmsDB.PDB";
compiling ok but I ger an error when I run the program: Error opening sms
file C:/Programmi/Palm/Tungst/Backup/SmsDB.PDB
This may be to do with the MS-DOS filename issue; if not, try opening
another file, if possible without a path name, and then one in the root
directory, just to see if that works.
If I use char* NAME_SMS = "\"c:/Programmi/Palm/Tungst/Backup/SmsDB.PDB\"";
compiling is ok but still I get the error: Error opening sms file
"c:/Programmi/Palm/Tungst/Backup/SmsDB.PDB"
That's expected. fopen() sees the entire string as the path name, extra
quote marks and all.
Richard