English 中文(简体)
乌班图——从终点站开立1 txt文档
原标题:Ubuntu - issue with opening a .txt file from terminal

我已经制定了一个电灯方案,以便把一些内容写到在电pp档案中创建的txt文档中。

然而,当我试图从终点站开立所创建的档案时,我可以写出所希望的内容,他说,尽管有,它还是无法找到。

When I try to open it with vi or nano it s content it s empty. It is like creating a new file.

然而,当我开放机场外时,我可以认为其内容符合我的愿望。

问题是什么,我如何纠正这种情况?

页: 1

问题在于<编码>系统(显示)的指挥。 我收到以下错误:<代码>sh:不能开放视频2.txt: 无此类文件。 我试图从指挥迅速开立档案,我得到上述情况。

int main(int argc,char* argv[])
{

fstream RawStipFile;
RawStipFile.open(strcat(argv[1],".txt"));
string line;

if (RawStipFile.is_open())
{

    getline(RawStipFile, line);
    int i = 0;
    ofstream OutVideoStip;
    ofstream VideoList;
    VideoList.open("VideoList.txt");
    while ( RawStipFile.good() )
    {

        getline (RawStipFile,line);
        char* l;
        l = (char*) malloc(sizeof(char));
        l[0]=line[0];
        //cout<<line[0]<<endl;
        if (line[0]==35)
        {

            if (OutVideoStip.is_open())
            {
                OutVideoStip.close();
            }
            i++;
                        //char* base;
                        //base = (char*) malloc(1000*sizeof(char));
                        //sprintf(base, "%d", i);
            char* b;
            b = &line[1];
            VideoList<<b<<endl;
            OutVideoStip.open(strcat(b, ".txt"));


        }

        else
        {

            OutVideoStip << line << endl;

        }


    }

    OutVideoStip.close();
    RawStipFile.close();
    VideoList.close();
}

else
{
    cout << "Unable to open file 
";
}

fstream VideoNames;
VideoNames.open("VideoList.txt", fstream::in);

if (VideoNames.is_open())
{
    while ( VideoNames.good() )
    {
        getline(VideoNames, line);
        line=line.substr(1,line.length());
        if (line.compare(""))
        {
            string initial = "./txt2mat<";
            initial.append(line);
            initial.append(".txt>");
            initial.append(line);
            initial.append(".dat");
            cout<<initial<<endl;
            const  char* buffer;
            buffer = initial.c_str();
            system(buffer);
        }
    }
}
else
{
    cout<<"Unable to open file. 
";
}

VideoNames.close();

return 0;
}
最佳回答
问题回答

只是一个松散的猜想:目前的工作名录并不相同?

采用<代码>chdir,首先使用或通过绝对途径开放<代码>/home/simon/VideoList.txt





相关问题
Undefined reference

I m getting this linker error. I know a way around it, but it s bugging me because another part of the project s linking fine and it s designed almost identically. First, I have namespace LCD. Then I ...

C++ Equivalent of Tidy

Is there an equivalent to tidy for HTML code for C++? I have searched on the internet, but I find nothing but C++ wrappers for tidy, etc... I think the keyword tidy is what has me hung up. I am ...

Template Classes in C++ ... a required skill set?

I m new to C++ and am wondering how much time I should invest in learning how to implement template classes. Are they widely used in industry, or is this something I should move through quickly?

Print possible strings created from a Number

Given a 10 digit Telephone Number, we have to print all possible strings created from that. The mapping of the numbers is the one as exactly on a phone s keypad. i.e. for 1,0-> No Letter for 2->...

typedef ing STL wstring

Why is it when i do the following i get errors when relating to with wchar_t? namespace Foo { typedef std::wstring String; } Now i declare all my strings as Foo::String through out the program, ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

Window iconification status via Xlib

Is it possible to check with the means of pure X11/Xlib only whether the given window is iconified/minimized, and, if it is, how?

热门标签