Hi,
I tryed to store this little function in the snippets db, but the I get an error message saying that this is not possible. What I am doing wrong?
int chomp(char *s)
{
char *p = strchr(s, '\n');
if ( p != NULL ) {
*p = '\0';
return 1;
}
return 0;
}
czerny
Ok... how did you try to do it?
Tools -> Customize -> snippets -> select type -> new snippet -> type or paste into dialog.
exactly!
Quote from: czerny on July 10, 2011, 12:08:50 AM
exactly!
Ummmm.... meaning what?
Did my suggestion work... or is that the one that failed?
This was the way that didn't work!
Have you tryed to do the same?
czerny
Quote from: czerny on July 10, 2011, 01:33:41 AM
This was the way that didn't work!
Have you tryed to do the same?
czerny
Yep, it worked for me on ver 6.50 rc4 x64 ....
But I typed my test in by hand...
EDIT:
Hrrrmmmm... copy and paste from outside the IDE doesn't seem to be working
but copy and paste from an IDE source window to the snippet does.
Kinda odd....
I (6.50 rc4 x86) tried it also (with different modifications) and I think only Pelle knows why you can't store it.
PS: If you remove the lines with "*p =" you can store it (but I think this will not help you).
Maybe problem with ' Single quote.
Use two single quotes for one single quote.
int chomp(char *s)
{
char *p = strchr(s, ''\n'');
if ( p != NULL ) {
*p = ''\0'';
return 1;
}
return 0;
}
I don't think the snippets window does syntax checking...
What I was wondering is if it was a clipboard format problem...
Text pushed to the clipboard as ASCII where the IDE is internally unicode ... ???
Hallo,
it looks as if the SQLite db does refuse the snipped because the single quotes are not escaped.
czerny
Hmmm... Ok, I took your sample code and copied it... I could paste it into the source editor but not the snippets window... if I copied it from the source editor, it pasted into the snippets window just fine...
Thats not the point!
Can you save it than?
czerny
When I copy from the Source editor, yes it saves.
When I copy from the first message, no it does not save.
I believe you've found a bug and you should report it as such in the appropriate forum
This is definitivly not the case with my version (6.50.8 R4 32 bit).
I can't save it neither from notepad nor from the ide copyed.
The only way I can save it is to double the single quotes.
czerny