Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: How to delete the last line of a txt file  (Read 37430 times)

0 Members and 2 Guests are viewing this topic.

Squashman



    Specialist
  • Thanked: 134
  • Experience: Experienced
  • OS: Other
Re: How to delete the last line of a txt file
« Reply #15 on: June 13, 2012, 04:49:15 PM »
I am not saying you should read directly from the environmental variable in your program.  I am saying pass it as a command line argument. This has nothing to do with a graphical interface.  If your program was setup correctly to read a variable from input you could call your program from your batch file like so.

MSL.exe %model%

I haven't programmed in C++ since I took my class in 1996 so I really can't recall how to do it but just about every Compiled and Interpreted programming Language can accept command line input in some fasion.

gpl



    Apprentice
  • Thanked: 27
    Re: How to delete the last line of a txt file
    « Reply #16 on: June 14, 2012, 01:47:15 AM »
    avoids trailing space

    Code: [Select]
    set model=blablabla
    0>nul set /p=%model%>mdchk.txt
    cool, thanks

    braglin

      Topic Starter


      Greenhorn

      • Experience: Beginner
      • OS: Unknown
      Re: How to delete the last line of a txt file
      « Reply #17 on: June 14, 2012, 04:16:23 AM »
      I am not saying you should read directly from the environmental variable in your program.  I am saying pass it as a command line argument. This has nothing to do with a graphical interface.  If your program was setup correctly to read a variable from input you could call your program from your batch file like so.

      MSL.exe %model%

      I haven't programmed in C++ since I took my class in 1996 so I really can't recall how to do it but just about every Compiled and Interpreted programming Language can accept command line input in some fasion.

      hum... I see, next time i will try it!!!

      Thank you for your help!

      Salmon Trout

      • Guest
      Re: How to delete the last line of a txt file
      « Reply #18 on: June 14, 2012, 04:39:29 AM »
      look for argv, argc, etc