Thread: problem in c++ can anyone help

  1. #1
    Registered User
    Join Date
    Oct 2007
    Posts
    5

    problem in c++ can anyone help

    my c++ program called Vprint generates the Embeddprogram.c program
    that embeddprogram.c i am calling through command line but getting the
    problem in fopen function ...
    before compiling it i have to manually change the the line
    flowCtrl = fopen ("C:\project\testcaserun.txt","w+");
    to
    flowCtrl = fopen ("C:\\project\\testcaserun.txt","w+");
    that i dont want ...
    because it is been genetared by the main C++program called Vprint so i need any one to see the code in Vprint ans suggest me how can i change my code to get the Embeddprogram.c file generated like
    flowCtrl = fopen ("C:\\project\\testcaserun.txt","w+");
    i am attaching the solution file please check this out

    i added all the three files create the project by including all the three file

  2. #2
    Frequently Quite Prolix dwks's Avatar
    Join Date
    Apr 2005
    Location
    Canada
    Posts
    8,057
    So in other words, where your program is printing a single \ you want to print two \\es. Simple. Change
    Code:
    sprintf(vStmt, "flowCtrl = fopen (\"C:\\project\\testcaserun.txt\",\"w+\");\n",flowFile);
    to
    Code:
    sprintf(vStmt, "flowCtrl = fopen (\"C:\\\\project\\\\testcaserun.txt\",\"w+\");\n",flowFile);
    along with wherever else you have similar code.

    void main() is bad, use int main(); see the FAQ.
    dwk

    Seek and ye shall find. quaere et invenies.

    "Simplicity does not precede complexity, but follows it." -- Alan Perlis
    "Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
    "The only real mistake is the one from which we learn nothing." -- John Powell


    Other boards: DaniWeb, TPS
    Unofficial Wiki FAQ: cpwiki.sf.net

    My website: http://dwks.theprogrammingsite.com/
    Projects: codeform, xuni, atlantis, nort, etc.

  3. #3
    Registered User
    Join Date
    Oct 2007
    Posts
    5

    Wink thanx

    tnanx mate

  4. #4
    Registered User
    Join Date
    Oct 2007
    Posts
    5
    thanks

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help understanding a problem
    By dnguyen1022 in forum C++ Programming
    Replies: 2
    Last Post: 04-29-2009, 04:21 PM
  2. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 11:22 AM
  3. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  4. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  5. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM