VS2015. _ftprintf don't work well - printf

I've got the followings sentences that work fine in VS2013 but not in VS2015. Do you know why?
FILE *m_fichero;
CString línea;
int a = 23;
_tfopen_s(&m_fichero, _T("fichero"), _T("w"));
línea = _T("Hola caracola");
_ftprintf(m_fichero, _T("%s. %d. %s\n"), linea, a, _T("Adios"));
The file created is
'H'. 123. Adios

Related

How to run SQLite3 'PRAGMA' commands via C-API?

Inside my C-program, I need to run the following pragma command:
const char *sql = "PRAGMA table_info(family)"; /* 'family' is the table name */
But whether i try to run this sql via sqlite3_exec() routine or sqlite3_prepare_v2() routine, my program stops responding/working at Windows command-prompt (it's a simple 'console program' in c-language).
Interestingly, when i run that same pragma sql at command-prompt normally by running the sqlite3.exe itself, it runs just fine and gives following output:
sqlite> pragma table_info(family);
cid name type notnull dflt_value pk
---------- ---------- ---------- ---------- ---------- ----------
0 id INTEGER 0 1
1 name TEXT 1 0
2 nickname TEXT 1 0
3 dob TEXT 1 CURRENT_TI 0
But inside my own c-program it doesn't. I have done a bit research about this problem. Both Googling and SQLite Documentation point towards this page here at the official docs. But unfortunately the given information there hasn't enabled me enough to resolve the problem. How can we successfully run SQLite3 'PRAGMA' commands via C-API?
EDIT: Here are the actual problematic lines of code. OR MCVE
I have found the reasons of my program's failure, and have fixed it (Courtesy of clues and leads in Murphy's answer. But for those interested in reproducing the problem, here are the actual lines of code which were causing program to "crash".
Inside my callback function for sqlite3_exec() routine, I had this piece of code(for-loop) for printing ' ---------- ' characters below column names to mimic ".mode column" & ".headers on" style of output in sqlite3 console.
int h;
for(h=0; h <= (strlen(col_value[i])+5); h++)
printf("-");
The problem was being caused by strlen() while printing 'headers' for PRAGMA sql's result column dflt_value which is null for first three columns in my table. If i stop running strlen() on dflt_value. the program runs fine. Similarly, in sqlite3_prepare_v2() routine the problem was being caused by the following lines:
int h;
for(h=0; h <= (strlen(sqlite3_column_text(stmt, 4))+5); h++)
printf("-");
If i remove or comment these lines, all runs well - albeit without ".headers on" style.
sqlite3_exec() should indeed be the way to go to execute pragma commands. You didn't give a MCVE (shame on you!), but I suspect that you either neglect handling error values, or something else is wrong with your code. You should try debugging it.

R studio: "Error in system(command, intern = T) : 'ls' not found"

I am in the process of using the GenABEL package of R studio to convert the output of the Affymetrix Genotyping Console into a .tfam file. This is my code thus far:
rm(list = ls())
setwd("C:/U/Is/GD/Affymetrix")
library("GenABEL", lib.loc="C:/PROGRA~1/R/R-211~1.1-X/library")
read.table("Genotyping_results.txt", fill = TRUE)
convert.snp.affymetrix(dir = "C:/U/Is/GD/Affymetrix", map = "Genotyping_results.txt" , outfile ="Genotyping_results.tfam")
I am getting the following error:
"Error in system(command, intern = T) : 'ls' not found".
I have a limited understanding of programming and am finding it difficult to understand what is wrong or how I can solve it.
Any help would be greatly appreciated
You mentioned in the comments that you're using Windows. ls is not a command on your OS.
ls is a command in Linux and in R.
There are many ways to add that command to Windows, like Cygwin.

XSL::Apache FOP java server connection

Got a project with Apache FOP, have to make a server based application which will use Apache FOP and pick XML+XSLT files, convert it to XSL:FO and then output an PDF file.
Everything works fine until it comes to XSL:FO=>PDF, Im getting a error in my console which tells me:
"could not connect to java server at line 15"
I'm a newbie programmer, and this might be a simple task to complete but I just can't figure it out how to run this bloody java server ... so my code might be working. Any help would be great. (FYI Im working on Windows)
Here is the Perl Code:
use XML::LibXSLT;
use XML::LibXML;
use XML::ApacheFOP;
my $parser = XML::LibXML->new();
my $xslt = XML::LibXSLT->new();
my $source = $parser->parse_file('books.xml');
my $style_doc = $parser->parse_file('books.xsl');
my $stylesheet = $xslt->parse_stylesheet($style_doc);
my $results = $stylesheet->transform($source);
my $Fop = XML::ApacheFOP->new();
$Fop->fop( xml => "books.xml", xsl => "books.xsl", outfile => "temp.pdf" )
or die "cannot create pdf: " . $Fop->errstr;
Would be glad to get some help.
Cheers.
You need to run JavaServer by this command
/path/to/java -classpath \
/path/to/JavaServer.jar\
:/usr/local/xml-fop/build/fop-0.20.5-RFC3066-patched.jar\
:/usr/local/xml-fop/lib/avalon-framework-cvs-20020806.jar\
:/usr/local/xml-fop/lib/batik.jar\
:/usr/local/xml-fop/lib/xalan-2.4.1.jar\
:/usr/local/xml-fop/lib/xercesImpl-2.2.1.jar \
com.zzo.javaserver.JavaServer
This works for me but with fop 0.20 with fop-0.20.5-RFC3066-patched.jar

wxDC::wxTextEntryDialog escapes newlines

wxTextEntryDialog converts '\n' into '\\n'
This code
dc.DrawText( "line a\nline b", 10, 100 );
outputs what I expect
line a
line b
So I code this:
wxTextEntryDialog dlg(this,"","Name the flower");
dlg.ShowModal();
setName( dlg.GetValue().wc_str() );
dc->DrawText( getName(), 10, 10 );
and type in
line a\nline b
and the display shows
line a\nline b
Using wxWidgets v3.0.1 on Windows
The drawing sample shows that DrawText() does work with multiple lines, so something must be wrong with your code. I can't say what though as you don't show us much, the snippet you do show wouldn't even compile because the arguments order is wrong, so clearly you must be doing something different in your real program.
The workaround is to add
wxString name = getName();
name.Replace("\\n","\n");
dc->DrawText( name, 10, 10 );
Full source code for demo app at https://www.dropbox.com/s/l6wu7pxtwvcj9vp/so26003871.zip?dl=0

VS2013 WinFX.targets mangled, can't open new/old project files

I have a bit of a strange problem and no amount of googling has given me any answers or solutions. I'm not entirely sure if it belongs on Stack Overflow, but since it involves VS/NET Framework, I thought I'd give it a try.
Whenever I try to create a new project or open an existing project in Visual Studio 2013, I get the following error:
"Unable to read the project file ".vcxproj".
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Microsoft.WinFx.targets(654,31): The project file could not be loaded. ';' is an unexpected token. The expected token is '='. Line 654, position 31."
I've discovered that the mentioned Microsoft.WinFx.targets file is damaged. Line 654 through 665 is filled with random binary data, beginning at column 31 as in the error message.
I have no clue what to do now. I can't reinstall .NET Framework 4.0 because it's already a part of Windows 8 and thus I can't run the standalone/web installers. I can't delete the file because it's protected by TrustedInstaller (which also leads me to the fact that I have no clue how or where to get a non-damaged copy of the file).
Just a bit of background info: I recently installed Windows 8, then upgraded to 8.1. I initially had Visual Studio 2013 Ultimate RC installed which worked at first. I hadn't used it in a week or two when I tried to load the Quake 3 source and first encountered the error. I thought it was because I was using an RC, so I uninstalled VS and installed VS13 Professional. Of course, this didn't solve my problem.
Any tips on how to proceed or insight into what may have happened?
The random data is the following:
;;Z<Ö<Û<æ<=F=Q=•=_>e>j>s>€>œ>«>°>¹>È>Ô>Ù>â>ñ>ö>ÿ>???+?0?9?H?M?V?i?n?w?Š??˜?«?°?¹?Ì?Ñ?Ú?í?ò?û? € ¼ 000/040=0P0U0^0q0v00’0—0 0³0¸0½0|2‚2“2™2½2Å23/373A3y3—3¸3¾3å3ð344Ð4à4 595C5g5†5Œ5—5ž5©5¾5ô586E6J6a6r6w6‰6¨6Ä6Û6÷677-7#7M7|7š7+8%9-9J9Z9};†;9>Q>]>b>€>°>(?ñ? ü ˆ001Ò1Ø1ã1ê12
222i2o2Œ2“2™2¶2É23:3D3O3“3í34,4#4v4Ú45D5H5L5P5T5C6^6Ü6¿7É7é7'8q8w8}8Š8“8™8H:Q:X:]:c:É:Ï:;f;y;„;Œ;”;œ;¤;¬;´;¼;Ä;Ì;Ô;Ü;ä;ì;ô;ü;<<<^>d>j>p>v>†>Œ>’>˜>ž>¤>µ>½>Ý>å>ú> ??? ?C?J?c?…?”?œ?ô?ø?   ¨ )000¬0½0Í0Ø0þ011#1/151=1C1S1Y1e1k1Ž1™1£1¨1¿1Ñ1Þ1é1ï1ø12222#2)23292?2Ð2Ø2ï2Ò34%4+464a4‰44”4Æ4â4ô45555%5*545#5F5L5V5\5b5æ5î56è6>•> >Ë>ð>? ?m?¬?¹? ° d ‹0Ø0â0°1ú12ë2:3D3'4E4W4¦4å4ò4Í56$6û6E7V7-8|8†8a9~9‘9£9â9ï9Á:;;æ;0>Ÿ>¬>‡?Ô?Þ? À € µ0ÿ01ç162#2F3Q3Õ3à344c4}4°4ó45Å5!616x6…6»6j7è7ý78g8È8Î8Þ8è899A9K9Æ9×9è9ù9M:’:ñ:;U;e<<ï<=y=•=æ=B>U>w>¶>?)?}? Ð | ›0·011M1Ç1ã172Œ2Ÿ2!3f3Å3Ù3-4K5g5á5ý5w6“6ç6C7V7ò7188¤8ô8: :Ž:ª:;4;…;Ú;í;
<ì>?p?w?Ø?è?ò? à x 0%0K0U0Ô0å0ö01n1³12*2z23©3434¡4½45j5}5Ÿ5Þ5A6U6©6Ê7æ78|8ö89f9»9Î9ð9/:’:¦:ö: <%<“<¯<=9=Š=ß=ò=>$>??y?º? ð # Â0,1o1€1*2B2´2/373a3q3~36ñ6 708ÿ8ù9:(:3:·<=¼=Ù>d?y? L Ÿ0ó0K1Œ1›1©1Þ1{4U5ƒ5”6'7q9Å9:<<ˆ<ª<±<(=^=å=ì=>>°>·>8?Y?¾?Å?ç?î? h p0w0Ù0à01 1˜1©2À2$3Ê4ó4515Ï5,6C6ˆ6š6ã6767 8‚8ý8X9½91:8:Z:a:à:Ž;x<Å<6===_=f=Ø=î=>/>P>ý>˜?ç? d F0%1©1$3¨3¯3P4á4x5Ž5¯5Ï5ð56~6…6§6®6À78L899#:x:´:Ò:Ü:ã:é:);/;4;E;I<m<w<Â<÷< =^=ö=F>Ø>G?u? 0 d (0/011Ø1^2l2{2‚22š2ü23$3+3 44È4Ï4À5Ó5ñ56,6=6y6†6˜6«6É6ñ677H7M79Ã9è9:Á:ç:;2;ï<=5= # ” 171Y1|1Ž1³1ÿ1°2È2&3.373<3L3Q33464=4G4S4¥4Ï4a5§5°5¸6!7z7€7ˆ7ž7£7±7¹7É7ç7Ù809f9è9õ9M:o:º:©;0<C<<}<™<µ<Ñ<â>>>^>}>œ>»>Û>û>?:?Y? P h 000L0i0T1~12,2³2Ý2Æ3â3ÿ3Î45A5Y5ø56(6E6a6}6™6ª6ó67J788V8#99¯:Ó:Ý:(;];†;Ê;b<²<6=¥=Ó=ˆ>>P?Ò? \ h0{0™0¶0Ô0å0
1a1r1â132;2D2I2Y2^2•2 3>3E3O3[3»3å3t4º4Ã4Ð57Ø7-<Æ<Í<E=Q=>>>C>¾>’? p D 0™12+2:2W2c2l2„2Š2ª3À3À657)9o9ý9C:Ë:j;§;Ø;ø;z<–<(=Ó=#>²> € \ ª01B1J1Y1v1‚1‹1£1®1´1p2&3C5n5Í5.686V6‡6§6/7K7Ý799‘99:; ;•;¡;„< =e=û=h>³>M?•? < o1{1ð1ü1o2{2ó2ÿ2t3€3N4Z4Ï4Û4Ÿ56–618ð8°9;®;K<L=…?‘?   # 0P0v0~0$1=1Á122ä3“4Æ4X5–5©5²56a7!8|;ƒ;¸;Ë;<]=¦>ì>‘? ° $ Ô102Õ2 66<6O6‡6k7Ÿ7Ä7ò7±8 Å3ó344w4’44¸4È4å4\5 Ï3 n3 0 ‚3 # ( D45575u8_9 =.?2?6?:?>?B?F?J? P 0151?28Ï>? # å1é1í1ñ1õ1ù1ý12Y2'3?3c36†7#;c=g=k=o=s=w={==×=¥>´>Í> p ( ç1(3¾6ì8ð8ô8ø8ü8 999ž9³:Ë:Ç; € ( ï1z8ã8µ;¹;½;Á;Å;É;Í;Ñ;J<=4=X= ( t0µ1B5€7„7ˆ7Œ77”7˜7œ7ô7m8‹8±8   E8Ý8û8!9€9“9®9û<ë= ° , ’1´3¸3¼3À3Ä3È3Ì3Ð3X5ð5646ë67ô7C> À 5L588
888888.8 Ð Ñ9 à õ<#>;>,? ð ;5 <[7³9Ì:X;û=f> F99¤9k;; # 0[0b0÷1
25::¸:Õ:ó:;+;P;;œ;R<‘<ä<è<ÿ<
==L=P=˜=p>ˆ>> 0 P J0j0ó0è1ð1ô1¢2ì2ð2÷2<3#3G3Œ33—3ä3è3g485ð6ø6ü67”8˜8Ÿ8D9H9ì;<&<1<4?j?¬? # È 0 0'0 0§0(141^11º1¿1¨2¯2Ï2Ô283S3X3r3À3˜4n55Œ5·5Ä5â546<6T6X6™6Û6è677x9l:y:¢:¯:Ð:Ø:ô:ø:þ:;A;Q;À;È;Í;Ô;Ú;à;å;ë;ñ;ú; <
<<<G>R>ô>? ?'?.?5?B?K?i?¶?º?¾?Â?Æ?Ê?Î?Ò? P œ 0 0<0e0Ñ0è011O1“1š1¥1¼1
2&27344n4u4Å4Ð4ß4õ455c5k5t5|5†5¡5µ5Ë5Þ56,6i6‚6©6ö6
7‰7©782888b89–9: ::;
;7;#;L;d;j;p;w; ?&?4?:?^?d?€?¯?µ?Ê?Ð?í? ˆ :0#0[0a0‚0ˆ0Ë0$1(151W1o1w11ˆ11á1ö152U2z2†2ò23s3•3ù3.4o4…4Õ4ë4;5Q5È5p7ð7[8n88Ÿ8²8Ä89$9ø;¨>?m??é? p ” 0s0º0ü01n1„1à1ö1€2‡2ó23o3‘3494{4‘4í45_5u5ð5÷5c6…6ä67m7³7ô7
8Z8p8À8Ö8X9_9ì9(:¢:¯:È:æ:";J;è;ï;<9…> >Á>Ü>:?c?¨?´?»?î?ø? € ¸ Z0»0è0û0151P1]1j1r1†1”1¢1«155,575D5Y5_5g5o5ª5¼5Û5â5ð5!606D6Q6e6Ð6Ö6C7 7§7 88`8g8À8Í8Ø8ï8ú89 9&9.969y9Ž9—9±9Å9:::x::Ø:ß:#;Ã; <,<9E>˜>ó>X?e?v?‚?–?£?·?¿?Å?×?Ý? ˆ 80D0 0b1i1å1ì1G2t2°2×23°3Ó3h4o4©4º4í4ó4H5€5™5æ5ü5636³6à6ç67E7Ð7Ù7à7ú738E8y8 8p9w9©9Ñ9ˆ::Å:ì:¸;Ñ;«<±<¼<=9=À=>!>+>A>„>¶>Þ>p?   ð c2i2n2‘2—2œ2À2š3¤3±3Ù3ß3ü3444h4o4~4„4¨4®4¶4Ñ4×4Ý4î4ô4ú4h5v5¥5«5Å5<6G6^6ž6Ô6Þ6ä6ñ6 7.747B7G7O7U7c7h7p7v7„7‰7‘7—7¥7ª7 8'8n8s8­8²8¹8¾8Å8Ê8Ø899B9H9è9õ9û9+:1:S:Z: