标签: edit

如何用C编辑txt文件的特定行

我目前正在尝试在 C 中编辑 .txt 文件的特定行。我使用的文件如下所示:

像素位置和 RGB 颜色

现在假设我想更改图像上突出显示的特定行上所写的内容:

400,300:(255,255,255)#FFFFFF

进入这个:

400,300: (000,000,000) #000000

基本上,我试图在特定像素上创建一个黑点,在本例中是 400,300。这就是我的代码:

#include <stdio.h>
int main(void)
{
    const char *filename = "sample.txt";
    int x = 400;
    int y = 300;

    FILE *fp;
    fp = fopen(filename, "w+");

    // Algorithm that reads all the file

    // If("Operation that reads" == x+","+y)
    // {
    //     Replace the line information after where it starts with "400,300"
    //     Like this : 400,300: (000,000,000) #000000
    // }


    // Algorithm that saves the …
Run Code Online (Sandbox Code Playgroud)

c io file edit

2
推荐指数
1
解决办法
1万
查看次数

将 sed 与 ${parameter} 一起使用

问题

我们如何在sed编辑字符串中使用变量?

例子

文件statement.txt就是这句话

我喜欢我的宠物鸟。

给定一个变量${myPet},我们如何使用中的值sed替换?bird${myPet}

什么不起作用

sed -ie 's/bird/${myPet}/g' statement.txt

结果是

我喜欢我的宠物${myPet}。

bash sed edit

2
推荐指数
1
解决办法
8819
查看次数

如何设置 ag-grid 单元格的最大长度

有没有什么方法可以maxLengthag-grid单元格中强加允许的文本,类似于普通输入元素上的文本?

  <input maxlength="220"/>
Run Code Online (Sandbox Code Playgroud)

没有找到相关文档。此外,我认为不需要特殊情况和更多细节。谢谢你!

edit max cell ag-grid

2
推荐指数
1
解决办法
9015
查看次数

Azure B2C EditProfile 自定义策略,无需先登录

现在,active-directory-b2c-custom-policy-starterpackProfileEdit.xml附带的文件要求用户登录,然后才真正让他们进入“编辑个人资料”页面。

我试图完成的用例有点不同。用户已经登录到应用程序,并且有一个按钮,Edit Profile单击该按钮会将用户带到“编辑个人资料”页面。也就是说,不应再次登录。

我的应用程序允许用户使用以下方式登录:FacebookLocal Account Signin。自定义 ProfileEdit B2C 策略应该知道用户使用哪一个登录,并直接将用户重定向到 ProfileEdit 策略。

我尝试搞乱ProfileEdit技术简介,但我所做的修改不起作用。

任何对 Azure B2C 自定义策略更有经验的人都可以告诉我如何实现这一目标吗?

customization edit azure user-profile azure-ad-b2c

2
推荐指数
1
解决办法
1496
查看次数

使用JQ将对象的一个​​字段复制到另一个对象中

在我的 JSON 中有一些具有Description属性的对象。如何使用 JQ 将此值复制到GMNotes同一对象的属性?

换句话说,一个人如何从

{
   "ObjectStates": [
      {
         "Description": "",
         "GMNotes": ""
      },
      {
         "Description": "foo",
         "GMNotes": ""
      }
   ]
}
Run Code Online (Sandbox Code Playgroud)

{
   "ObjectStates": [
      {
         "Description": "",
         "GMNotes": ""
      },
      {
         "Description": "foo",
         "GMNotes": "foo"
      }
   ]
}
Run Code Online (Sandbox Code Playgroud)

.ObjectStates[] | .GMNotes = .Description只返回修改后的对象,如沙箱中所示。

(我可以在 Perl 中轻松完成此操作。重点是使用jq。)

json edit jq

2
推荐指数
1
解决办法
1537
查看次数

如何编辑订单而不在magento 1.7中创建新订单

有没有办法在没有从Magento管理员创建新订单的情况下编辑Magento中的订单?我怎么能做到这一点?

edit magento

1
推荐指数
1
解决办法
8234
查看次数

C++在.txt文件中查找整数值

我有一个map.txt文件:

[Map]
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 
0 0 …
Run Code Online (Sandbox Code Playgroud)

c++ integer position file edit

1
推荐指数
1
解决办法
124
查看次数

PHP - 编辑/删除文件中的特定行

我有一个文件users.txt,其中包含:

"ID" "Access" ;Expire>>26-08-2013<<
"ID" "Access" ;Expire>>27-08-2013<<
"ID" "Access" ;Expire>>28-08-2013<<
Run Code Online (Sandbox Code Playgroud)

我不想检查过期日期是否大于当前日期时间,如果是,我想在该行的开头添加分号或者只是删除该行.

我到目前为止写的代码如下:

$files = file('users.txt');
foreach ($files as $line) {

    $pattern = '/>>(.*)<</';
    preg_match($pattern, $line, $matches);
    $expiredate = strtotime($matches[1]);
    $currdate = strtotime(date('d-m-Y'));
    if ($currdate > $expiredate) {
        echo 'access expired... edit/delete the line<br/>';
    } else {
        echo 'do nothing, its ok -> switching to the next line...<br/>';
    }

 }
Run Code Online (Sandbox Code Playgroud)

它从文件中的每一行检索"过期日期".它还会检查它是否大于当前日期,但此时我不知道如何编辑(通过在开头添加分号)或删除满足条件的行.

有什么建议?

php file edit

1
推荐指数
1
解决办法
9866
查看次数

ColdFusion修改文本文件中的单行

有没有办法在ColdFusion中编辑文本文件的单行内容?

据我所知,我必须读取并缓冲整个文本文件,然后按原样逐行重写,直到找到我必须修改的行,放入我想要的值,然后继续重写其余的线条原样.

我不喜欢重写整个文件的想法..我想找到一种编辑单行的方法,你有什么建议?

更多细节

基本上我有一个看起来像这样的配置文件

my_own.thingy.blabla1 = "true";
my_own.thingy.bla_bla = 1337;
my_own.thingy.foo_bar_baz = "what ever...";
Run Code Online (Sandbox Code Playgroud)

我的CFC控制器收到"编辑bla_bla到42"之类的请求

我需要

  1. 将配置文件读入变量
  2. bla_bla定义的变量中找到位置
  3. 将子串1337替换为42
  4. 使用包含已修改文件文本的已修改变量重写该文件

我正在寻找一个很好的方法来做第2步和第3步,因为#1和#2是微不足道的

编辑:有人指出我使用JSON,但我不知道这将如何适用于此.

coldfusion file-io edit

1
推荐指数
1
解决办法
947
查看次数

Zsh:从下划线更改行编辑光标吗?

如果我尝试编辑先前的shell命令(通过历史记录键获得),则光标变为下划线。如果该命令涉及目录或文件名,则已经加了下划线,因此光标就消失了。

我正在使用zprezto-如何更改光标字符或形状?

command-line zsh edit cursor

1
推荐指数
1
解决办法
1303
查看次数

标签 统计

edit ×10

file ×3

ag-grid ×1

azure ×1

azure-ad-b2c ×1

bash ×1

c ×1

c++ ×1

cell ×1

coldfusion ×1

command-line ×1

cursor ×1

customization ×1

file-io ×1

integer ×1

io ×1

jq ×1

json ×1

magento ×1

max ×1

php ×1

position ×1

sed ×1

user-profile ×1

zsh ×1